#include <bits/stdc++.h>
using namespace std;
int n, k, a[200000 + 100];
int b[200000 + 100], mmax = -1;
bool judge(int x) {
  int flag = 0;
  for (int i = 1; i <= mmax; i++) {
    if (b[i] >= x) flag += b[i] / x;
  }
  if (flag >= k)
    return true;
  else
    return false;
}
int main() {
  int ans[200000 + 100];
  int mid;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    mmax = max(mmax, a[i]);
    b[a[i]]++;
  }
  int l = 1, r = n, num = 1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (judge(mid)) {
      l = mid + 1;
      num = mid;
    } else
      r = mid - 1;
  }
  int top = 0;
  for (int i = 1; i <= 200000 + 100; i++) {
    for (int j = 1; j <= b[i] / num; j++) {
      ans[top++] = i;
      if (top == k) {
        i = 200000 + 100;
        break;
      }
    }
  }
  for (int i = 0; i < top - 1; i++) {
    printf("%d ", ans[i]);
  }
  printf("%d\n", ans[top - 1]);
  return 0;
}
