#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
void solve()
{
    int n,m;
    cin>>n>>m;
    vector<int>v;
    map<ll,ll> mp;
    for(ll i=0; i<m; i++)
    {
        ll b;
        cin>>b;
        mp[b]++;
        if (mp[b]==n)
            v.pb(b);
    }
    cout<<v.size()<<endl;
    for(auto &i:v)
        cout<<i<<' ';
}
 main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt=1;
 //cin >> tt;
  while(tt--)
  {
    solve();
  }
}
