#include <bits/stdc++.h>

using namespace std;

map <int, int> mp;

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