import std.stdio;
import std.string;
import std.conv;

void main() {
	long n, k;
	scanf("%ld %ld\n", &n, &k);
	auto a = readln.chomp.split.to!(long[]);
	auto s = new long[n+1];
	foreach(ref x; s) x = -1;
	ulong last = 0;
	long stride;
	for(long i;; ++i) {
		if (last == 0 && i > 0 && i % n == 0){
			stride = i;
			break;
		}
		foreach(j, ref x; s) {
			if (j >= last) {
				++last;
				x = a[i%n];
				break;
			}
			if (x == a[i%n]){
				last = j;
				break;
			}
		}
	}
	last = 0;
	foreach(ref x; s) x = -1;
	foreach(i; 0..(n * k - 1) % stride + 1) {
		foreach(j, ref x; s) {
			if (j >= last) {
				++last;
				x = a[i%n];
				break;
			}
			if (x == a[i%n]){
				last = j;
				break;
			}
		}
	}
	foreach(x; s[0..last]) write(x, " ");
}
