#include <iostream>
#include <map>
#include <vector>
using namespace std; 

int main() {
long long n,m,var=0;
  cin>>n>>m;
map <long long,long long>freq;
vector  <long long> ans;
  for(long long i=0;i<m;i++){
    int type;
    cin>>type;
   freq[type]++;
  }
  for(auto x:freq){
    if(x.second>=n){
      ans.push_back(x.first);
      var++;
    }
  }
  cout<<var<<endl;
  for(long long j=0;j<ans.size();j++){
    cout<<ans[j]<<"";
  }
  return 0;
}