#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <bitset>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <vector>
#define fir first
#define sec second

using ll = long long;
template<typename T>
bool rMin(T& a, const T& b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool rMax(T& a, const T& b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

using namespace std;


void solve(){
    set<int> els;
    multiset<int> eels;
    vector<int> ans;
    int qe, el, mv;
    cin >> mv >> qe;
    while(qe--){
        cin >> el;
        els.insert(el);
        eels.insert(el);
    }
    for(auto i : els){
        if(eels.count(i) >= mv) ans.push_back(i);
    }
    cout<< ans.size() << '\n';
    for(auto i : ans) cout << i << ' ';
    cout << '\n';

}

int main(){
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    cout.precision(10);
    int t = 1;

    //cin >> t;

    for(int i = 0; i < t; ++i){
        solve();
    }
}