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

using ll = long long;
using namespace std;

int main() {
    int n, m;
    std::cin >> n >> m;
    std::map<int, int>mp;
    for (int i = 0; i < m; ++i) {
        int ai;
        std::cin >> ai;
        mp[ai]++;
    }
    std::vector<int>ans;
    for (auto &i : mp) {
        if (i.second >= n) {
            ans.push_back(i.first);
        }
    }
    std::cout << (int)ans.size() << '\n';
    for (auto& i : ans) {
        std::cout << i << ' ';
    }
    return 0;
}