#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
map<long long,long long>mp;
vector<long long>v;
long long n,m,i,a;
cin>>n>>m;
for(i=1;i<=m;i++){
    cin>>a;
    mp[a]++;
}
for( auto a:mp){
    if(a.second>=n){
        v.push_back(a.first);
    }
}
cout<<(long)v.size()<<endl;
for(auto a:v){
    cout<<a<<" ";
}
    return 0;
}
