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
  if f == 0
    period = pos
    pos = ((N * K - 1) / period) * period
  end
end

t = a[f..(N - 1)]

puts t.join(' ')