typedef long long ll;
typedef long double ld;

#define all(a) a.begin(), a.end() 
#define rall(a) a.rbegin(), a.rend() 
#define love ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 


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

const std::string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const std::string alp = "abcdefghijklmnopqrstuvwxyz";
const ll mod1 = 1e9 + 9;
const ll p1 = 47;
const ll mod2 = 1e9 + 1000 - 7;
const ll p2 = 41;

using namespace std;


void solve() {
    int n, k;
    cin >> n >> k;
    unordered_map<int, int> m;
    vector<int> a(k);
    vector<int> out;
    for (int i = 0; i < k; i++) {
        cin >> a[i];
        m[a[i]]++;
    }

    for (pair<int, int> elem : m) {
        if (elem.second >= n) out.push_back(elem.first);
    }
    cout << out.size() << "\n";
    for (auto num : out) cout << num << " ";
}


int main() {
    love; // ❤❤❤ 
    int t = 1;
    // cin >> t; 
    while (t--) {
        solve();
        cout << "\n";
    }
}