#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <random>
#include <chrono>

using namespace std;

using ll = long long;
using ld = long double;

mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long
#define all(x) (x).begin(), (x).end()

void solve() {
    ll n, m, el;
    cin >> n >> m;
    map<ll, ll> cnt;
    for (int i = 0; i < m; i++) {
        cin >> el;
        cnt[el]++;
    }
    vector<ll> res;
    for (auto &e : cnt) {
        if (e.second >= n) {
            res.push_back(e.first);
        }
    }
    cout << res.size() << '\n';
    for (auto el : res) {
        cout << el << ' ';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll timer = 1;
    // cin >> timer;
    while (timer--) {
        solve();
    }
    return 0;
}
