#include <iostream>
#include <vector>
using namespace std;

int main(){
	long long n,k,p,zamena=0;
	cin>>n>>k;
	vector<long long> v;
	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++;
			v.push_back(i-n);
		}
	}
	cout<<zamena<<endl;
	for(long long i=0;i<v.size();i++){
		cout<<v[i]<<" ";
	}
}