#include<iostream>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[2*n+1];
	int b[n];
	int pogodak[2*n+1];
	for(int i=0;i<=2*n;i++)pogodak[i]=0;
	int s=-n;
	int mete=0;
	for(int i=0;i<=2*n;i++)
	{	
		a[i]=s;
		s++;
	}
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		for(int j=0;j<=2*n;j++)
		{
			if(a[j]==b[i])
			{
				pogodak[j]++;
				j=2*n+1;
			}
		}
	}
	for(int i=0;i<=2*n;i++) if(pogodak[i]>=k)mete++;
	cout<<mete<<endl;
	for(int i=0;i<=2*n;i++) if(pogodak[i]>=k) cout<<a[i]<<" ";
	cout<<endl;
}