#include <iostream>
using namespace std;

int main(){
	long long n,k,p,zamena=0;
	cin>>n>>k;
	long long polje[2*n+1];
	for(long long i=0;i<=2*n;i++){
		polje[i]=0;
	}
	for(long long i=0;i<n;i++){
		cin>>p;
		polje[p+n]+=1;
	}
	for(long long i=0;i<=2*n;i++){
		if(polje[i]>=k)
			zamena++;
	}
	cout<<zamena<<endl;
	for(long long i=0;i<=2*n;i++){
		if(polje[i]>=k){
			cout<<i-n<<" ";
		}
	}
}