#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;

int main(){
    long long n,m,a;
    cin>>n>>m;
    vector<long> arr;
    unordered_map<long long, long long> map;
    for(int i=0;i<m;i++){
        cin>>a;
        map[a]++;
    }
    for(auto i:map){
        if(i.second>=n){
            arr.push_back(i.first);
        }
    }
    cout<<arr.size()<<"\n";
    for(int i=0;i<(int)arr.size();i++){
        cout<<arr[i]<<" ";
    }
    return 0;
    
}
