#include<iostream>
#include <vector>

using namespace std;

int main(){
	int x;
	long int n,k,br;
	
	cin>>n>>k;
	
	long int a[2*n+1];
	vector<int> ind;
	
	for(long int i = 0;i<=2*n;i++){
		a[i]=0;
	}
	
	for(long int i = 0;i<n;i++){
		cin>>x;
		a[x+n]++;
	}
	
	for(long int i = 0;i<=2*n;i++){
		if(a[i]>=k){
			br++;
			ind.push_back(i);
		}
	}
	
	cout<<br<<endl;
	
	for(long int i = 0;i<br;i++){
		cout<<ind[i]-n<<" ";
	}
}