#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

void solve() {
    int n, m;
    cin >> n >> m;

    map<int, int> mp;
    int c;
    for (int i = 0; i < m; i++) {
        cin >> c;
        if (mp.find(c) == mp.end()) {
            mp[c] = 1;
        } else {
            mp[c]++;
        }
    }

    vector<int> ans;
    for (auto[first, second]: mp) {
        if (second >= n) {
            ans.push_back(first);
        }
    }

    cout << ans.size() << '\n';
    for (int a: ans) {
        cout << a << ' ';
    }
}


signed main()
{
    int t = 1;
    //cin >> t;
    //freopen("input.in", "r", stdin);
    while (t--) {
        solve();
    }
    return 0;
}

