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

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

    ll n, m;
    cin >> n >> m;
    vector<ll> v(m);
    set<ll> ans;
    for(ll i = 0; i < m; ++i){
        cin >> v[i];
        if (count(v.cbegin(),v.cend(),v[i])>=n)
            ans.insert(v[i]);
    }

    cout << ans.size() << "\n";
    for(auto u: ans){
        cout << u << " ";
    }
}
