using namespace std;

#define all(a) a.begin(),a.end()
#define pb push_back
#define vt vector
#define endl '\n'
typedef long long ll;

const int inf=1e9;
const int N=6e5+605;

void solve(){
    int n,m;
    cin>>n>>m;
    int a[n+2];
    map<int,int>mp;
    for(int i=1; i<=m; ++i){
        cin>>a[i];
        mp[a[i]]++;
    }
    vt<int>v;
    for(auto [x,y]:mp){
        if(y>=n){
            v.pb(x);
        }
    }
    cout<<v.size()<<endl;
    for(auto x:v){
        cout<<x<<' ';
    }
}

int main(){
 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 int tt=1;
 //cin>>tt;
 while(tt--) {
  solve();
 }
}