#include <iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<fstream>
#include<string>
#include<random>
#include<cmath>
#include<ctime>
#include<set>
#include<unordered_map>
#include<map>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
typedef long long ll;
using namespace std;
int main()
{
	ll n, m;
	cin >> n >> m;
	vector<ll>ans;
	unordered_map<ll, ll> A;
	ll buf;
	for (ll i = 0; i < m; ++i)
	{
		cin >> buf;
		A[buf]++;
	}
	for (auto&y : A)
	{
		if (y.second >= n)
		{
			ans.push_back(y.first);
		}
	}
	cout << ans.size() << '\n';
	for (auto&y : ans) {
		cout << y << " ";
	}
	return 0;
}