#include <bits/stdc++.h>

using namespace std;

int main(){
    int n;
    int64_t k;
    cin >> n >> k;
    vector<int> A(n);
    for (auto &a: A) cin >> a;

    map<int, vector<int>> M;

    for (int i = 0; i < n; i++){
        M[A[i]].push_back(i);
    }

    int i = 0;
    int c = 0;
    while (true){
        int a = A[i];
        auto p = upper_bound(M[a].begin(), M[a].end(), i);
        if (p == M[a].end()){
            p = M[a].begin();
            c++;
        }

        i = *p;
        i = (i + 1) % n;

        if (i == 0)
            break;
    }

    c++;
    k %= c;
    i = 0;

    while (true){
        int a = A[i];
        auto p = upper_bound(M[a].begin(), M[a].end(), i);
        if (p == M[a].end()){
            p = M[a].begin();
            k--;
        }

        if (k == 0)
            break;

        i = *p;
        i = (i + 1) % n;
    }

    for (; i < n; i++){
        int a = A[i];
        auto p = upper_bound(M[a].begin(), M[a].end(), i);
        if (p == M[a].end()){
            cout << A[i] << " ";
            continue;
        }
        i = *p;
    }
    cout << endl;

}