#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[200005],nxt[200005],lst[200005];
int main()
{
	int N;long long K;
	scanf("%d%lld",&N,&K);
	for(int i = 1;i <= N;i ++)
		scanf("%d",&a[i]),a[i+N] = a[i];
	int fir = 1;
	for(int i = N<<1;i >= 1;i --)
		nxt[i] = lst[a[i]],lst[a[i]] = i;
	int c = 0;bool fi = 1;
	while(fir != 1 || fi)
	{
		fi = 0;
		int rx = nxt[fir]+1;
		if(rx > N)
			c ++,rx -= N;
		fir = rx;
	}
	K %= c;
	ll rk = K*N;
	c = 1;ll r = 0;
	while(true)
	{
		int r2 = nxt[c];
		if(r2+r*N == rk)
			return 0;
		r2 ++;
		if(r2+r*N <= rk)
			c = r2;
		else
			break;
		if(r2 > N)
			c -= N,r ++;
	}
	for(int i = c;i <= N;)
	{
		int j = i;
		while(j <= N)
		{
			int r2 = nxt[j];
			if(r2 == N)
				return 0;
			r2 ++;
			if(r2 > N)
				break;
			j = r2;
		}
		printf("%d ",a[j]);
		i = j+1;
	}
	printf("\n");
	return 0;
}