#include <iostream>
using namespace std;

int main(){
	long long n, k, y, z, x=0;
	long long *a, *b;
	string s="";
	scanf("%lld%lld", &n, &k);
	a=(long long*)malloc((2*n*+1)*sizeof(long long));
	b=(long long*)malloc((2*n*+1)*sizeof(long long));
	for(z=0; z<n; z++){
		scanf("%lld", &y);
		a[y+n+1]++;
	}
	for(z=0; z<2*n+1; z++){
		if(a[z]>=k){
			b[x]=z-n-1;
			x++;
		}
	}
	printf("%lld\n", x);
	for(z=0; z<x; z++){
		s+=to_string(b[z]);
		if(z!=x-1)s+=" ";
	}
	cout << s;
	return 0;
}