#include <bits/stdc++.h>
using namespace std;
long long int n, k, A[200006], tt;
pair<long long int, long long int> times[200006], temp[200006];
bool bstar(long long int x) {
  long long int tt = 0;
  for (long long int i = 1; i <= 200000; i++) tt += (times[i].first / x);
  return tt >= k;
}
int main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> A[i];
  for (long long int i = 1; i <= 200000; i++) times[i].second = i;
  for (long long int i = 0; i < n; i++) times[A[i]].first++;
  sort(times + 1, times + 200000 + 1,
       greater<pair<long long int, long long int> >());
  long long int st = 0, en = n + 1, mid = 0;
  while (en - st > 1) {
    mid = ((st + en) / 2);
    if (bstar(mid))
      st = mid;
    else
      en = mid;
  }
  if (st > 0) {
    long long int co = 0;
    for (long long int i = 1; i <= 200000; i++) {
      if (co >= k) break;
      for (long long int j = 0; j < (times[i].first / st); j++) {
        if (co >= k) break;
        cout << times[i].second << " ";
        co++;
      }
      if (co >= k) break;
    }
    assert(co == k);
  } else {
    assert(0);
    for (long long int i = 0; i < n; i++) cout << A[i] << " ";
  }
}
