#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#define int long long
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    int n,m;
    cin>>n>>m;
    map <int,int> count;
    for (int i=0;i<m;i++){
        int a;
        cin>>a;
        count[a]++;
    }
    vector<int> ans;
    for(auto& x:count){
        if(x.second>=n){
            ans.push_back(x.first);
        }
    }
    cout<<ans.size()<<'\n';
    for(auto& x: ans){
        cout<<x<<" ";
    }
    
}