#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin>>n>>m;
    map<int, int> a;
    while(m--){
        int q;
        cin>>q;
        ++a[q];
    }
    vector<int> ans;
    for (auto i: a){
        if(i.second >= n){
            ans.push_back(i.first);
        }
    }
    cout<<ans.size()<<endl;
    for (int i: ans){
        cout<<i<<" ";
    }
    return 0;
}
