#include <bits/stdc++.h>
using namespace std;
 

void setIO(string name = "") {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
}

#define ll long long
#define pb() push_back()
#define neutral 0

const int INF = 1e9+7;
const double pi = 3.14159265358979323846; 

long long gcd(long long a, long long b){
    return b ? gcd(b, a%b) : a;
}


ll merge(ll x, ll y){
    return x^y;
}

vector<ll> tree;
vector<ll> a;
void update(ll node, ll l, ll r, ll index, ll value){
    if(l==r){tree[node]=value;return;}
    int mid=(l+r)/2;
    if(mid>=index)update(node*2, l, mid, index, value);
    else update(node*2+1, mid+1, r, index, value);
    tree[node] = merge(tree[node * 2], tree[node * 2 + 1]);
}

ll func(ll node, ll l, ll r, ll ql, ll qr){
    if(l>=ql && r<=qr){
        return tree[node];
    }
    if(ql>r || qr<l){
        return neutral;
    }
    ll mid = (l+r)/2;
    return merge(func(node*2, l, mid, ql, qr), func(node*2+1, mid+1, r, ql, qr));
}


void solve() {
    int n, k; cin>>n>>k;
    vector<int> v(k);
    map<int, int> m;
    for(int i=0; i<k; i++){
        cin>>v[i];
        m[v[i]]++;
    }
    vector<int> days;
    for(auto u: m){
        if(u.second>=n)days.push_back(u.first);
    }
    cout<<days.size()<<"\n";
    for(int i=0; i<days.size(); i++){
        cout<<days[i]<<" ";
    }




    // int n, q; cin>>n>>q;
    // vector<int> v(n);
    // for(int i=0; i<n; i++){
    //     cin>>v[i];
    // }
    // for(int i=0; i<q; i++){
    //     int x; cin>>x;
    //     int left=0, right=n-1, mid;
    //     while(left<=right){
    //         mid=(left+right)/2;
    //         if(v[mid]==x){cout<<mid+1<<"\n";break;}
    //         else if(v[mid]<x)left=mid+1;
    //         else right=mid-1;
    //     }
    //     if(v[mid]!=x){
    //         if(mid==0)cout<<0<<"\n";
    //         else cout<<mid+1<<"\n";
    //     }
    // }

}
 
int main() {   
    auto start = chrono::high_resolution_clock::now();  
    setIO();  
    int testCases=1;
    // cin>>testCases;
    while(testCases--){
        solve();
    }
    #ifdef LOCAL
    cout<<"\n\n______________________________________\n";
    auto duration = chrono::duration_cast<chrono::microseconds>(chrono::high_resolution_clock::now() - start);
  
     cout << "time: " << (double)duration.count()/1000.0 << " milliseconds" << endl;
    #endif
    
}