#include <bits/stdc++.h>
#define d 1000000

using namespace std;
int niz[2000003];
int n, k, a;

int main () {
    cin >>  n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a;
        int h = a + d;
        if (niz[h] != -1)
            niz[h]++;
        if (niz[h] == k) {
            cout << a << " ";
            niz[h] = -1;
        }

    }

    cout << endl;

    return 0;

}