#include <bits/stdc++.h>

#define ll long long

using namespace std;

int main() {
    ll n, m, k = 0;
    cin >> n >> m;
    map < ll, ll > mp;
    for(int i = 0; i < m; i++){
        ll x;
        cin >> x;
        mp[x]++;
        if(mp[x] == n){
            k++;
        }
    }
    cout << k << "\n";
    for(auto &i: mp){
        if(i.second >= n){
            cout << i.first << " ";
        }
    }
}

