//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline ll getLowestOneBit(ll a)
{
	return a & (-a);
}

inline ll getHighestOneBit(ll a)
{
	while ((a & (a - 1)) != 0)
	{
		a = a & (a - 1);
	}
	return a;
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getSpecifiedBit(ll a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, K;
	cin >> N >> K;

	vector<ll> As(N);
	for (ll i = 0; i < N; ++i)
	{
		cin >> As[i];
	}

	map<ll, ll> numToPrevIndex;
	map<ll, ll> currIndexToNextIndex;
	for (ll i = 0; i < N; ++i)
	{
		if (numToPrevIndex.count(As[i]))
		{
			currIndexToNextIndex[numToPrevIndex[As[i]]] = i + 1;
		}
		numToPrevIndex[As[i]] = i;
	}
	for (ll i = 0; i < N; ++i)
	{
		if (numToPrevIndex.count(As[i]))
		{
			currIndexToNextIndex[numToPrevIndex[As[i]]] = N + i + 1;
			numToPrevIndex.erase(As[i]);
		}
	}

	map<ll, ll> resToCurr;
	map<ll, ll> loopLastIndex;
	ll res = 0, currIndex = 0, loopCount, loopStartIndex;
	loopLastIndex[currIndex / N] = res;
	while (true)
	{
		if (resToCurr.count(res))
		{
			loopCount = (currIndex - resToCurr[res]) / N;
			break;
		}
		resToCurr[res] = currIndex;
		currIndex += currIndexToNextIndex[res] - res;
		res = currIndex % N;
		loopLastIndex[currIndex / N] = res;
	}

	auto loopLastIndexStart = loopLastIndex[(K - 1) % loopCount];

	for (ll i = loopLastIndex[(K - 1) % loopCount]; i < N;)
	{
		if (currIndexToNextIndex[i] > N)
		{
			cout << As[i] << " ";
			++i;
		}
		else
		{
			i = currIndexToNextIndex[i];
		}
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 40576