#include<bits/stdc++.h>
using namespace std;
int main()
{
	vector<long long>v;
	long long a,b;
	cin>>a>>b;
	long long m[b],mx=-10e9;
	for (long long i=0; i<b; i++)
	{
		cin>>m[i];
		if (m[i]>mx) mx=m[i];
	}
	int ch[mx+2]={0,};
	for (long long i=0; i<b; i++)
	{
		ch[m[i]]++;
	}
	for (long long i=1; i<=mx; i++)
	{
		if (ch[i]>=a) v.push_back(i);
	}
	cout<<v.size()<<endl;
	for (long long x:v)
	{
		cout<<x<<" ";
	}
}