#include <bits/stdc++.h>
#define ll long long
#define ff irst
#define ss second
#define pb push_back
#define mp make_pair

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    while (m--) {
        int x;
        cin >> x;
        ++mp[x];
    }
    vector<int> a;
    for (auto i : mp) {
        if (i.second >= n)
            a.pb(i.first);
    }
    cout << a.size() << '\n';
    for (auto i : a)
        cout << i << ' ';
    return 0;
}
