#include<iostream>
using namespace std;

int main(){
	int n,k,i,z,b[2*n];
	cin>>n>>k;
	int a[2*n];
	for(i=0;i<2*n;i++)a[i]=0;
	for(i=0;i<n;i++){
		cin>>z;		
		if(z<0)a[n+z]+=1;
		else a[n+z]+=1;
	}
	z=0;
	for(i=0;i<2*n;i++)if(a[i]>=k){
		z++;
	}
	cout<<z<<endl;
	for(i=0;i<n;i++)if(a[i]>=k)cout<<-n+i<<" ";
	for(i=n;i<2*n;i++)if(a[i]>=k)cout<<i-n<<" ";
	return 0;
	
	
}