#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    int n, m; cin >> n >> m;
    vector<int> v(m);
    map<int, int> cnt;
    for (int i=0; i<m; i++) {
        cin >> v[i];
        cnt[v[i]]++;
    }
    vector<int> ans;
    for (auto p : cnt) {
        if (p.second>=n) {
            ans.push_back(p.first);
        }
    }
    cout<<ans.size()<<"\n";
    for (auto u : ans) {
        cout<<u<<" ";
    }
}
