#include <bits/stdc++.h>
using namespace std;
int b[2000005];
vector<pair<int, int> > op;
int main() {
  long long n, k;
  cin >> n >> k;
  int i;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i], b[a[i]]++;
  for (i = 1; i <= 200000; i++) {
    if (b[i] > 0) {
      op.push_back(make_pair(b[i], i));
    }
  }
  sort(op.begin(), op.end());
  long long st = 1, en = 200005;
  long long re = 0;
  while (st <= en) {
    long long mid = (st + en) / 2;
    long long now = 0;
    for (i = 0; i < op.size(); i++) {
      now += (op[i].first / mid);
    }
    if (now >= k) {
      re = mid;
      st = mid + 1;
    } else {
      en = mid - 1;
    }
  }
  vector<int> res;
  int nowk = 0;
  int j;
  for (i = 0; i < op.size(); i++) {
    int v = op[i].first / re;
    for (j = 0; j < v; j++) {
      if (nowk == k) {
        break;
      } else {
        res.push_back(op[i].second);
        nowk++;
      }
    }
  }
  for (i = 0; i < res.size(); i++) cout << res[i] << " ";
  return 0;
}
