#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int n, k, x, ma, ans, num1[200010], topt;
struct dat {
  int num, id;
} a[maxn];
bool cmp(dat aa, dat bb) { return aa.num > bb.num; }
bool ok(int xx) {
  int nn = 0;
  for (int i = 1; i <= topt; i++) {
    nn += a[i].num / xx;
  }
  if (nn < k) return 0;
  return 1;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &x), num1[x]++, ma = max(ma, x);
  for (int i = 1; i <= ma; i++)
    if (num1[i] != 0) {
      a[++topt].id = i;
      a[topt].num = num1[i];
    }
  sort(a + 1, a + topt + 1, cmp);
  int l = 1, r = n;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (ok(mid)) {
      ans = max(ans, mid);
      l = mid + 1;
    } else
      r = mid - 1;
  }
  for (int i = 1; i <= topt; i++) {
    int ci = a[i].num / ans;
    ci = min(ci, k);
    for (int j = 1; j <= ci; j++) printf("%d ", a[i].id);
    k -= ci;
    if (k == 0) break;
  }
  return 0;
}
