#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;
    ll x;
    map<ll, ll> my_map;
    for(ll i = 0; i < m; ++i){
        cin >> x;
        my_map[x]++;
    }
    vector<ll> ans;
    for(auto u: my_map){
        if(u.second >= n){
            ans.push_back(u.first);
        }
    }
    cout << ans.size() << "\n";
    for(auto u: ans){
        cout << u << " ";
    }
}
