#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    vector<int> c(m);
    for (int i = 0; i < m; ++i) {
        cin >> c[i];
    }

    set<int> otvet;
    for (int i = 0; i < m; ++i) {
       if (count(c.begin(), c.end(), c[i]) >= n) {
            otvet.insert(c[i]);
        }
    }

    cout << otvet.size() << endl;
    for (auto i = otvet.begin(); i != otvet.end(); ++i) {
        cout << *i << " ";
    }

    return 0;
}