#include <iostream>
#include <map>
#include <set>
using namespace std;
int main(){
    int n, m, a, s = 0;
    cin >> n >> m;
    set <int> st;
    map <int, int> mp;
    for (int i = 0; i < m; i++) {
        cin >> a;
        mp[a]++;
    }
    for (auto i : mp) {
        if(i.second >= n){
            ++s;
            st.insert(i.first);
        }
    }
    cout << s << endl;
    for (auto i : st) {
        cout << i << " ";
    }
    return 0;
}