N,K,*A = `dd`.split.map &:to_i
NK = N*K
AA = A + A
indexmap = {}
hop = Array.new(N,nil)
(0...N).reverse_each{ |i| indexmap[AA[N+i]] = N+i }
(0...N).reverse_each{ |i|
  hop[i] = (indexmap[AA[i]] + 1) - i
  indexmap[AA[i]] = i
}

orbit_s = 0
orbit_t = 0
k = 0
while true do
  d = hop[k]
  orbit_s += d
  orbit_t += 1
  k = (k + d) % N
  break if k == 0
end
$stderr.puts N,K,orbit_s,orbit_t

i = (NK/orbit_s)*orbit_s
ans = []
while i < NK do
  a = A[i % N]
  j = hop[i % N] + i
  if j <= NK
    i = j
  else
    ans << a
    i += 1
  end
end
puts ans * " "
