#include <bits/stdc++.h>

using namespace std;

using ll = long long;


void solve()
{

    map<int,int> ma;
    vector<int> ans;
    int n,m,tmp;
    cin>>n>>m;
    for(int i = 0; i<m; i ++){
        cin>>tmp;
        ma[tmp]++;
        if (ma[tmp] == n){
            ans.push_back(tmp);
        }
    }


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

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //freopen("input.txt", "r", stdin);
    ll t = 1;
    for(ll r = 0; r < t; r++)
    {
        solve();
    }
    return 0;
}
