N, K = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)

cycle = []
N.times do |i|
	cnt = 1
	while a[(i + cnt) % N] != a[i]
		cnt += 1
	end
	cycle[i] = cnt + 1
end
pos = 0
f = 0
while pos + cycle[f] <= N * K
	pos += cycle[f]
	f = (f + cycle[f]) % N
end

s = []
t = a[f..(N - 1)]
if t == []
  exit
end
t.size.times do |k|
	n = t[k]
	if s[0] == n
		s = []
		next 
	end
	(1..s.size).each do |i|
		if i == s.size
			s.push(n)
		elsif s[i] == n
			s = s[0..i-1]
			break
		end
	end
end
puts t.join(' ')