#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define int ll

int n,m;
map<int,int> c;
vector<int> ans;
main()
{
    cin >> n >> m;
    while(m--){
        int x;
        cin >> x;
        c[x]++;
    }
    for(auto [x,y]:c){
        if(y  >= n){
            ans.push_back(x);
        }
    }
    cout << ans.size() << '\n';
    for(auto i:ans) cout << i << ' ';
}