#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; lint k; cin >> n >> k;
  V<> a(n); for (auto&& e : a) cin >> e;
  map<int, int> mp;
  V<> nxt(n);
  for (int i = 2 * n - 1; i >= 0; --i) {
    if (i < n) nxt[i] = mp[a[i]];
    mp[a[i % n]] = i;
  }

  V<lint> vis(n, -1);
  V<> res;
  lint p = 0;
  bool first = true;
  while (p < n * k) {
    if (first and vis[p % n] != -1) {
      lint c = (p - vis[p % n]);
      p += (n * k - p) / c * c;
      first = false;
      continue;
    }
    vis[p % n] = p;
    lint q = p / n * n + nxt[p % n] + 1;
    if (q > n * k) {
      res.push_back(a[p++ % n]);
    } else {
      p = q;
    }
  }

  int m = res.size();
  for (int i = 0; i < m; ++i) cout << res[i] << " \n"[!(m + ~i)];
}