#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>

#ifndef Debug
#pragma GCC optimize("O3")
#endif

using ll = long long;

void bipkos() {
    ll n, m;
    std::cin >> n >> m;
    std::vector<ll> a(m);
    for (int i = 0; i < m; ++i) {
        std::cin >> a[i];
    }
    std::map<ll, ll> d;
    for (int i = 0; i < m; ++i) {
        ++d[a[i]];
    }
    std::vector<ll> mb, ans;
    for (auto [u, cnt] : d) {
        if(cnt >= n){
            ans.push_back(u);
        }
    }
    std::cout << ans.size()<<'\n';
    for (int i = 0; i < ans.size(); ++i) {
        std::cout << ans[i] <<' ';
    }
}

int main() {
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false);
    int t = 1;
//    std::cin >> t;
    while (t--) {
        bipkos();
    }
}
