#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()

int main(){
  int n;
  uint64_t k;
  cin >> n >> k;
  vector<int> a(n);
  REP(i, n){
    cin >> a[i];
  }
  vector<int> j(n, -1);
  vector<int> l(200020, -1);
  REP(i, n){
    int x = a[i];
    if(l[x] >= 0){
      j[l[x]] = i + 1;
    }
    l[x] = i;
  }
  REP(i, n){
    int x = a[i];
    if(l[x] >= 0){
      j[l[x]] = n + i + 1;
      l[x] = -1;
    }
  }
  int p = 0;
  int q = 0;
  do{
    p = j[p];
    q += p / n;
    p %= n;
  }while(p != 0);
  k %= q;
  if(k == 0){
    cout << endl;
    return 0;
  }
  q = 0;
  while(1){
    int np = j[p];
    if(np >= n){
      q += 1;
      if(q == k) break;
      np -= n;
    }
    p = np;
  }
  bool first = true;
  while(p < n){
    if(j[p] <= n){
      p = j[p];
    }else{
      if(!first) putchar(32);
      printf("%d", a[p]);
      first = false;
      ++p;
    }
  }
  puts("");
  return 0;
}
