#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 1;
int n, k, a[N];
pair<int, int> freq[N];
bool can(int mid) {
  int with = 0;
  for (int i = 0; i < N; ++i) {
    if (with >= k) return true;
    with += freq[i].first / mid;
  }
  return with >= k;
}
int main() {
  for (int i = 0; i < N; ++i) freq[i].second = i;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", a + i), ++freq[a[i]].first;
  sort(freq, freq + N);
  reverse(freq, freq + N);
  int l = 1, r = 1e9, mid, res = 0;
  while (l <= r) {
    mid = (l + r) / 2;
    if (can(mid)) {
      res = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  int count = 0;
  for (int i = 0; count < k && i < N; ++i) {
    for (int j = 0, tmp = freq[i].first / res; count < k && j < tmp; ++j) {
      printf("%d ", freq[i].second);
      ++count;
    }
  }
  puts("");
  return 0;
}
