#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 2;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
  return;
}
int n, k, t;
int a[maxn];
bool OK(int m) {
  int res = 0;
  for (int i = 1; i <= (int)2e5; i++) {
    if (a[i] < m) continue;
    res += a[i] / m;
  }
  return res >= k;
}
int main(void) {
  read(n), read(k);
  for (int i = 0; i < n; i++) read(t), a[t]++;
  int l = 1;
  int r = n;
  int mid, amount = 1;
  while (l <= r) {
    mid = (l + r) >> 1;
    OK(mid) ? amount = mid, l = mid + 1 : r = mid - 1;
  }
  vector<int> ans(k);
  int tot = 0;
  for (int i = 1; i <= (int)2e5; i++) {
    if (a[i] < amount) continue;
    for (int j = 1; j <= a[i] / amount; j++) {
      ans[tot++] = i;
      if (tot == k) {
        i = (int)2e5 + 1;
        break;
      }
    }
  }
  while (k--) printf("%d ", ans[k]);
  puts("");
}
