#include <cstdio>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int, int> pii;
int main()
{
	unordered_map<int, int>M;
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 0, x; i < n; i++)
		scanf("%d", &x), M[x]++;
	auto cnt = vector<pii>(M.begin(), M.end());
	sort(cnt.begin(), cnt.end(), [](const pii&lhs, const pii&rhs) {
		return lhs.second > rhs.second;
	});
	int l = 1, r = n, m;
	while (l < r)
	{
		m = (l + r) >> 1;
		int len = 0;
		for (auto ite = cnt.begin(); ite != cnt.end(); ++ite)
			if (ite->second < m) break;
			else len += ite->second / m;
		if (len >= k)
			l = m + 1;
		else
			r = m;
	}
	vector<int>ans;
	for (auto ite = cnt.begin(); ite != cnt.end(); ++ite)
		if (ite->second < r) break;
		else for (int i = ite->second / r; i; i--)
			ans.push_back(ite->first);
	for (int i = 0; i < k; i++)
		printf("%d ", ans[i]);
	return 0;
}