#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

void razmeni(long long *a,long long *b){
	long long pom;
	pom=*a;
	*a=*b;
	*b=pom;
}

	void quick(long long levi, long long desni, long long u[]){
		long long i,j,d;
		if(levi<desni){
			i=levi;
			j=desni;
			d=u[desni];
			while(i!=j){
				while(u[i]<d)
					i++;
				while((u[j]>=d) && (i<j)){
					j--;
			}
				if(i<j)
					razmeni(&u[i],&u[j]);
					
			}
			razmeni(&u[i],&u[desni]);
			quick(levi,i-1,u);
			quick(i+1,desni,u);
		}
	}

void unos(long long a[],long long n){
	for(long long i=0;i<n;i++)
		cin>>a[i];
}

int main(){
	long long n,k,br;
	//cout<<"Unesite n: ";
	cin>>n;
	//cout<<"Unesite k: ";
	cin>>k;
	long long a[n];
	unos(a,n);
	quick(0,n-1,a);
	br=0;
	for(long long i=0;i<n;i++){
		if(((br==0) || (a[i]==a[i-1])) && br<k){
			br++;
		}
		else if(a[i]!=a[i-1]){
			br=1;
		}
		if(br==k){
			cout<<a[i]<<"\t";
			br=k+1;	
		}
	}
}