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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int roze, khidmat;
    cin >> roze >> khidmat;
    vector<int> khizmat(khidmat);
    map<int, int> shumarKhidmat;
    vector<int> javob;

    for (int i = 0; i < khidmat; i++) {
        cin >> khizmat[i];
        shumarKhidmat[khizmat[i]]++;

        if (shumarKhidmat[khizmat[i]] == roze) {
            javob.push_back(khizmat[i]);
        }
    }

    cout << javob.size() << endl;

    for (int khizmat : javob) {
        cout << khizmat << " ";
    }

    return 0;
}
