#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> mm;
bool ok(long long int mid, long long int k) {
  map<long long int, long long int>::iterator it;
  for (it = mm.begin(); k && it != mm.end(); it++) {
    if (it->second >= mid) {
      k -= (long long int)(it->second / mid);
    }
  }
  if (k > 0) return 0;
  return 1;
}
void print(long long int mid, long long int k) {
  map<long long int, long long int>::iterator it;
  for (it = mm.begin(); k && it != mm.end(); it++) {
    if (it->second >= mid) {
      for (int i = 0; k && i < (long long int)(it->second / mid); k--, i++)
        cout << it->first << " ";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, b, n = 0, mx = 0, sum = 0, ans = 0;
  bool f = 0, flag = 0;
  cin >> n >> k;
  long long int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    mm[a[i]]++;
    mx = max(mx, mm[a[i]]);
  }
  long long int lo = 1, hi = mx, mid = 0;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (ok(mid, k)) {
      lo = mid + 1;
      ans = mid;
    } else {
      hi = mid - 1;
    }
  }
  print(ans, k);
  return 0;
}
