#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <cassert>
#include <random>
#include <chrono>
#include <tuple>

#pragma GCC optimize("03")
#pragma GCC target("avx2")

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ii = int;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ii n, m;
    cin >> n >> m;
    unordered_map <ii, ii> mp;
    ii now;
    for (ii i = 0; i < m; ++i) {
        cin >> now;
        mp[now]++;
    }

    deque <ii> ans;
    for (auto it : mp) {
        if (it.second >= n) {
            ans.push_back(it.first);
        }
    }

    cout << ans.size() << endl;
    for (ii i : ans) {
        cout << i << ' ';
    }
    return 0;
}
