#include <bits/stdc++.h>
using namespace std;
int n, a[200001], l, r, tot, cut, k, ans[200001], tmp[200001];
struct da {
  int x, o;
} s[200001];
using namespace std;
bool check(int x) {
  cut = 0;
  for (int i = 1; i <= tot; i++) {
    int y = s[i].x;
    while (y >= x) y -= x, tmp[++cut] = s[i].o;
    if (cut >= k) return true;
  }
  return false;
}
void erfen(int l, int r) {
  int mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) {
      l = mid + 1;
      for (int i = 1; i <= k; i++) ans[i] = tmp[i];
    } else
      r = mid - 1;
  }
  return;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int x = 1e9;
  for (int i = 1; i <= n; i++) {
    if (x == a[i])
      s[tot].x++;
    else
      s[++tot].o = a[i], s[tot].x = 1, x = a[i];
  }
  erfen(1, n);
  for (int i = 1; i <= k; i++) printf("%d ", ans[i]);
  return 0;
}
