#include "bits/stdc++.h"

using namespace std;

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

    map<int,int> s;

    for (int i = 0;i < m;i++){
        int x;
        cin >> x;
        s[x]++;
    }

    vector<int> ans;
    for (const auto &item: s){
        if (item.second >= n){
            ans.push_back(item.first);
        }
    }

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

signed main() {
#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;

    while (t--) solve();
}
