#include <iostream>
#include <unordered_map>
#include <vector>

int main() {
    int n, m;
    std::cin >> n >> m;
    
    int counter = 0;
    std::unordered_map<int, int> map;
    std::vector<int> ans;
    
    while (m > 0) {
        m--;
        int i;
        std::cin >> i;
        
        if (map.find(i) != map.end()) {
            map[i]++;
        } else {
            map[i] = 1;
        }
    }
    
    for (const auto& pair : map) {
        if (pair.second >= n) {
            ans.push_back(pair.first);
            counter++;
        }
    }
    
    std::cout << counter << std::endl;
    for (const auto& num : ans) {
        std::cout << num << " ";
    }
    
    return 0;
}