//ALEX ENACHE

// < INCLUDE > ----------------------------------------------------------------

#include <vector>
#include <algorithm>

#include <math.h>
#include <iomanip>
#include <bitset>

#include <queue>
#include <deque>
#include <stack>

#include <map>
#include <unordered_map>
#include <set>

#include <random>
#include <time.h>
#include <assert.h>

using namespace std;

// < PRAGMA > -----------------------------------------------------------------

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#pragma warning(disable:4996)

// < PRECODED > ---------------------------------------------------------------

long long lgput(long long a, long long b, long long MOD) {
	long long ret = 1LL;
	while (b) {
		if (b & 1LL) ret = (ret * a) % MOD;
		a = (a * a) % MOD;
		b >>= 1LL;
	}

	return (ret % MOD);
}

long long inv_mod(long long x, long long MOD) {
	return lgput(x, MOD - 2, MOD);
}

long long GCD(long long a, long long b) {
	long long c;
	while (b) {
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

long long LCM(long long a, long long b) {
	return (a * b) / GCD(a, b);
}

long long big_rand() {
	return 1LL * rand() * RAND_MAX + rand();
}

long long xtime() {
	return clock() * 1000LL / CLOCKS_PER_SEC;
}

bool exist(double nr, double eps) {
	return (nr < -eps) || (nr > eps);
}

long long modd(long long nr, long long MOD) {
	return ((nr % MOD) + MOD) % MOD;
}

// < READ > -------------------------------------------------------------------

#include <iostream> 
//#include <fstream>
//ifstream cin("input"); ofstream cout("output"); 
//ifstream cin(".in"); ofstream cout(".out");

// < START > ------------------------------------------------------------------

void start() {
#ifdef _DEBUG
	freopen("input", "r", stdin); freopen("output", "w", stdout);
#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cout << setprecision(10) << fixed;
	srand(time(nullptr));
}

// < CONSTANTS > --------------------------------------------------------------

const mt19937 rng(time(nullptr));
const double PI = acos(-1);
const double eps = 1e-6;
const long long inf = 1e9;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;

const long long MAXN = 2e5 + 10;
const long long LOG = 64;

// < STRUCTURES > -------------------------------------------------------------

struct nod {
	int x, y;
};

// < VARIABLES > --------------------------------------------------------------

long long n , k;
int v[MAXN];
int last[MAXN];

long long pos[LOG][MAXN];
long long val[LOG][MAXN];

// < FUNCTIONS > --------------------------------------------------------------

void read() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
	}
}

int nxt(int nr) {
	if (nr == n) {
		return 1;
	}
	return nr + 1;
}


void solve() {
	read();

	for (int i = n; i >= 1; i--) {
		last[v[i]] = i;
	}
	for (int i = n; i >= 1; i--) {
		pos[0][i] = last[v[i]];
		if (last[v[i]] > i) {
			val[0][i] = last[v[i]] - i;
		}
		else {
			val[0][i] = n - i + last[v[i]];
		}
		last[v[i]] = i;
	}

	for (int bit = 1; bit < LOG; bit++) {
		for (int i = 1; i <= n; i++) {

			if (val[bit-1][i] == -1 || INF - val[bit - 1][i] < 1LL + val[bit - 1][nxt(pos[bit - 1][i])]) {
				val[bit][i] = -1;
			}
			else {
				pos[bit][i] = pos[bit - 1][nxt(pos[bit - 1][i])];
				val[bit][i] = val[bit - 1][i] + 1LL + val[bit - 1][nxt(pos[bit - 1][i])];
			}
			
			//cout << "VAL " << i << " " << bit << " : " << val[bit][i] << '\n';
		}
	}

	long long VAL = 1;
	long long POS = 1;

	for (int bit = LOG-1; bit >= 0; bit--) {
		if (val[bit][POS] != -1 && VAL <= n * k - val[bit][POS]) {
			VAL += val[bit][POS] + 1LL;
			POS = nxt(pos[bit][POS]);
		}
	}

	//cout << VAL << " " << POS << '\n';

	if (VAL > n * k) {
		return;
	}

	for (int i = POS; i <= n; i++) {
		if (pos[0][i] > i) {
			i = pos[0][i];
			continue;
		}
		cout << v[i] << " ";
	}

}

// < MAIN > -------------------------------------------------------------------

int main() {

	start();

	solve();

	return 0;
}

// < TROUBLESHOOT > -----------------------------------------------------------

/*
Pre-submit:
Write a few simple test cases, if sample is not enough.
Are time limits close? If so, generate max cases.
Is the memory usage fine?
Could anything overflow?
Make sure to submit the right file.

Wrong answer:
Print your solution! Print debug output, as well.
Are you clearing all datastructures between test cases?
Can your algorithm handle the whole range of input?
Read the full problem statement again.
Do you handle all corner cases correctly?
Have you understood the problem correctly?
Any uninitialized variables?
Any overflows?
Confusing N and M, i and j, etc.?
Are you sure your algorithm works?
What special cases have you not thought of?
Are you sure the STL functions you use work as you think?
Add some assertions, maybe resubmit.
Create some testcases to run your algorithm on.
Go through the algorithm for a simple case.
Go through this list again.
Explain your algorithm to a team mate.
Ask the team mate to look at your code.
Go for a small walk, e.g. to the toilet.
Is your output format correct? (including whitespace)
Rewrite your solution from the start or let a team mate do it.

Runtime error:
Have you tested all corner cases locally?
Any uninitialized variables?
Are you reading or writing outside the range of any vector?
Any assertions that might fail?
Any possible division by 0? (mod 0 for example)
Any possible infinite recursion?
Invalidated pointers or iterators?
Are you using too much memory?
Debug with resubmits (e.g. remapped signals, see Various).

Time limit exceeded:
Do you have any possible infinite loops?
What is the complexity of your algorithm?
Are you copying a lot of unnecessary data? (References)
How big is the input and output? (consider scanf)
Avoid vector, map. (use arrays/unordered_map)
What do your team mates think about your algorithm?

Memory limit exceeded:
What is the max amount of memory your algorithm should need?
Are you clearing all datastructures between test cases?
*/

Measured memory_bytes: 195584