#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 2e5 + 50;
int cnt[N];
int check(int m)
{
    int sum = 0;
    for (int i = 0; i < N; i++)
        if (cnt[i] >= m)
            sum += cnt[i] / m;
    return sum;
}
int main()
{
    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 0, x; i < n; i++)
        scanf("%d", &x), cnt[x]++;
    int l = 1, r = n, m;
    while (r - l > 1)
        if (check(m = ((l + r) >> 1)) >= k)
            l = m;
        else
            r = m;
    for (int i = 0; i < N && k; i++)
        if (cnt[i] >= l)
            for (int j = cnt[i] / l; j && k; j--)
                printf("%d ", i), k--;
    return 0;
}
