#include <bits/stdc++.h>
using namespace std;

    typedef long long ll;
    typedef long double ld;

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

    int now;
    map <int, int> cnt;
    for (int i = 0; i < m; ++i) {
        cin >> now;
        ++cnt[now];
    }

    vector <int> rez;
    for (auto it : cnt) {
        if (it.second >= n) {
            rez.push_back(it.first);
        }
    }

    cout << rez.size() << '\n';
    for (auto it : rez) cout << it << ' ';
    cout << '\n';
}

signed main() {
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }
}
