#include <bits/stdc++.h>
using namespace std;
int cnt[200005];
int calc(int t) {
  int res = 0;
  for (int i = 1; i <= 200000; i++) {
    res += cnt[i] / t;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;
  }
  int lf = 1, ri = 200005, mid;
  while (lf < ri) {
    mid = (lf + ri) / 2;
    if (calc(mid) < k)
      ri = mid;
    else
      lf = mid + 1;
  }
  if (calc(mid) < k) mid--;
  int p, tot = 0;
  while (tot < k) {
    for (int i = 1; i <= 200000; i++) {
      if (tot == k) break;
      p = cnt[i] / mid;
      for (int j = 0; j < p; j++) {
        cout << i << " ";
        tot++;
        if (tot == k) break;
      }
    }
  }
  return 0;
}
