#include <iostream>
#include <map>
using namespace std;
map<int,int> m;
int ans[300009], z = 0;
int main()
{ 
    int n,p,q;
    cin>>n>>p;
    for (int i = 0; i < p; i++){
        cin>>q;
        m[q]++;
        if (m[q] == n) ans[z++] = q;
    }
    cout<<z<<endl;
    for (int i = 0; i < z; i++)
        cout<<ans[i]<<" ";
}