#include <bits/stdc++.h>
using namespace std;
struct te {
  int x, s;
} ns[200010];
bool cmp(te a, te b) { return a.s > b.s; }
int n, k, su[200010], x, cnt;
bool judge(int x) {
  int sum = 0;
  for (int i = 1; i <= cnt; i++) {
    sum += ns[i].s / x;
    if (sum >= k) return 1;
  }
  return 0;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    su[x]++;
  }
  for (int i = 1; i <= 200000; i++)
    if (su[i]) ns[++cnt].x = i, ns[cnt].s = su[i];
  sort(ns + 1, ns + cnt + 1, cmp);
  int r = ns[1].s, l = ns[k].s;
  int mid = (r + l) / 2;
  int ans;
  while (r >= l) {
    if (judge(mid)) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
    mid = (r + l) / 2;
  }
  int sum = 0;
  for (int i = 1; i <= n && sum < k; i++) {
    for (int j = 1; j <= ns[i].s / ans && sum < k; j++) {
      cout << ns[i].x << " ";
      sum++;
    }
  }
  return 0;
}
