#include <bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    // freopen("prices.in", "r", stdin);
    // freopen("prices.out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tests = 1;
//    cin >> tests;
    while (tests--){
        int n, m;
        cin >> n >> m;
        int a[m + 12];
        map <int , int> mp;
        set <int> st;
        vector <int> vc;
        for(int i = 1; i <= m; ++ i){
            cin >> a[i];
            st.insert(a[i]);
            mp[a[i]] ++;
        }
        for(auto to : st){
            if(mp[to] >= n){
                vc.push_back(to);
            }
        }
        cout << vc.size() << '\n';
        for(auto to : vc){
            cout << to << ' ';
        }
    }
}
