#include <iostream>
#include <vector>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int arr[2*n] = { 0 };
	bool check[2*n] = { 0 };
	vector<int> zamena;
	for(int i = 0; i < n; ++i)
	{
		int temp;
		cin >> temp;
		arr[temp + n]++;
		if(arr[temp+n] >= k && !check[temp+n])
		{
			zamena.push_back(temp+n);
			check[temp+n] = true;
		}
	}
	
	for(int i = 0; i < zamena.size(); ++i)
		cout << zamena[i] - n <<" ";
}