///@CodeByUsmonjk@
#include<bits/stdc++.h>
#define ll long long
#define ul unsigned long long
#define in short int
#define fr first
#define sc second
#define mpl map<ll , ll>
#define mps map<ll , string>
#define mpc map<ll , char>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define pb push_back
#define vpl vector<pair<ll , ll>>
#define out cout<<
#define in cin>>
#define en '\n'
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;

ll a,b,c,d,e,f,g,h,n,n1,n2,n3,n4,cnt,ans,pz ,mx ,mx1 ,mx2 ,mx3 ,mn=1e9 ,mn1=1e9 ,mn2=1e9 ,mn3=1e9;
long double aa,bb,cc,dd,ee,ff,gg,hh;
string s,s1,s2,s3,ss;

void solve()
{
   in a>>b;
   mpl mp;
   vl v;
   for(ll i=0; i<b; i++)
   {
       in c;
       mp[c]++;
       if(mp[c]==a)
       {
           v.pb(c);
       }
   }
   out v.size()<<en;
   for(ll i=0; i<v.size(); i++)
   {
       out v[i]<<" ";
   }
}

int main()
{
    ios
    ll t=1;
    ///cin>>t;
    while(t--)
    {
        solve();
    }
}

/***

92183747213987412123
2
22
44

***/







