#include <iostream>
#include <map>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int arr[m];
    map<int, int> mp;
    int num;
    int arr2[m];
    for(int i = 0; i < m; i++)
    {
        cin >> arr[i];
        mp[arr[i]]++;
    }
    int cnt = 0;
    for(auto i : mp)
    {
        if(i.second >= n)
        {
            arr2[cnt] = i.first;
            cnt++;
        }
    }
    cout << cnt << endl;
    for(int i =0; i < cnt; i++)
    {
        cout << arr2[i] << " ";
    }
}
