n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
s = []
for i in 0..(n * k - 1) do
  x = a[i % n]
  if !s.include?(x)
    s.push(x)
  else
    while s.include?(x) do
      s.pop
    end
  end
end
puts s.join(" ")
