
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    map<int, int> m1;
    for (int i = 0; i < m; ++i){
        int a;
        cin >> a;
        m1[a]++;

    }
    vector<int> v;
    for (auto h : m1){
        if (h.second > n - 1){
            v.push_back(h.first);
        }
    }
    cout << v.size() << '\n';
    for (auto i : v){
        cout << i << " ";
    }
    return 0;
}