#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_geneous = 0; ngtkana_is_geneous < n; ngtkana_is_geneous++)
#define rep(i, begin, end) for(int i = begin; i < end; i++)

#define LOCAL
using std::to_string;
auto to_string(std::string s) -> std::string {
  return '"' + s + '"';
}
auto to_string(char c) -> std::string {
  return "'" + std::string{c} + "'";
}
auto to_string(const char* s) -> std::string {
  return to_string((std::string) s);
}
auto to_string(bool b) -> std::string {
  return (b ? "true" : "false");
}
template <typename T, typename U>
auto to_string(std::pair<T, U> p) -> std::string {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <size_t N>
auto to_string(std::bitset<N> bs) -> std::string {
  std::string res{};
  for (size_t i = 0; i < N; i++)
    res.insert(res.begin(), bs.test(i) ? '1' : '0');
  return res;
}
template <typename T>
auto to_string(T v) -> std::string {
  bool flg = false;
  std::string res = "{";
  for (auto const&x : v) {
    if (flg) res += ", ";
    else flg = true;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  std::cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template <typename T>
auto make_vector(size_t sz, T t) {
  return std::vector<T>(sz, t);
}
template <size_t N, typename T, typename U, std::enable_if_t<
  N == 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t sz, U u) {
  return make_vector(sz, T(u));
}
template <size_t N, typename T, std::enable_if_t<
  N == 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t sz) {
  return std::vector<T>(sz);
}
template <size_t N, typename T, typename... Args, std::enable_if_t<
  N != 1, std::nullptr_t> = nullptr>
auto make_higher_vector(size_t a, Args... args) {
  return make_vector(a, make_higher_vector<N - 1, T>(args...));
}
template <typename T, typename Size_t>
auto& at(T& t, Size_t i) {
  return t.at(i);
}
template <typename T, typename Size_t, typename... Args>
auto& at(T& t, Size_t i, Args... args) {
  return at(t.at(i), args...);
}

int main()
{
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; long long k; std::cin >> n >> k;
  k *= n;
  std::vector<int> a(n);
  for (auto& x : a)
  {
    std::cin >> x;
    x--;
  }
  std::vector<int> b;
  loop(2) std::copy(a.begin(), a.end(), std::back_inserter(b));
  int kind = 2e5;
  std::vector<long long> tab0(n);
  std::vector<int> prv(kind, -1);
  for (int i = 2 * n - 1; i >= 0; i--)
  {
    auto crr = b.at(i);
    if (i < n)
    {
      assert(prv.at(crr) != -1);
      tab0.at(i) = prv.at(crr) - i + 1;
    }
    prv.at(crr) = i;
  }
  constexpr long long inf = 1LL << 60;
  int  hight = std::log2(1e18);
  auto table = make_higher_vector<2, long long>(hight, n);
  table.at(0) = std::move(tab0);
  rep(p, 1, hight)
  {
    table.at(p) = table.at(p - 1);
    rep(i, 0, n)
    {
      auto dif1 = at(table, p - 1, i);
      auto dif2 = at(table, p - 1, (i + dif1) % n);
      at(table, p, i) = std::min(inf, dif1 + dif2);
    }
  }
  long long crr = 0;
  for (int p = hight - 1; p >= 0; p--)
  {
    long long next = std::min(inf, crr + at(table, p, crr % n));
    if (next < k)
    {
      crr = next;
    }
  }
  std::vector<int> having(kind, false);
  std::vector<int> ret;
  auto eat = [&] (int x)
  {
    auto& flag = having.at(x);
    if (flag)
    {
      while (true)
      {
        auto y = ret.back(); ret.pop_back();
        having.at(y) = false;
        if (y == x) break;
      }
    }
    else
    {
      ret.push_back(x);
      flag = true;
    }
  };
  while (crr < k)
  {
    auto pos = crr % n;
    eat(a.at(pos));
    crr++;
  }
  int ret_size = ret.size();
  for (int i = 0; i < ret_size; i++)
  {
    std::cout << (i > 0 ? " " : "") << ret.at(i) + 1;
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 99512