#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
    int n,m,cnt=0;
    cin>>n>>m;
    vector<int> arr(m);
    for(int i=0;i<m; i++){
        cin>>arr[i];
    }
    map<int, int> elementCount;

    for (int element : arr) {
        elementCount[element]++;
    }

    for (const auto& pair : elementCount) {
        if (pair.second >= n) {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    for (const auto& pair : elementCount) {
        if (pair.second >= n) {
            cout<<pair.first<<" ";
        }
    }

    return 0;
}
