#include <bits/stdc++.h>
using namespace std;
pair<bool, vector<int> > ok(int cnt[], int n, int x, int k,
                            bool saveAnswer = 0) {
  vector<int> result;
  int resultCnt = 0;
  for (int i = 0; i < n; ++i) {
    int it = cnt[i];
    resultCnt += it / x;
    if (saveAnswer) {
      for (int j = 0; j < it / x; ++j) {
        result.push_back(i);
      }
    }
  }
  return make_pair(resultCnt >= k, result);
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n], cnt[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<int> cc;
  for (int i = 0; i < n; ++i) cc.push_back(a[i]);
  sort(cc.begin(), cc.end());
  cc.resize(unique(cc.begin(), cc.end()) - cc.begin());
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; ++i) {
    a[i] = lower_bound(cc.begin(), cc.end(), a[i]) - cc.begin();
    ++cnt[a[i]];
  }
  int l = 0, r = n + 1;
  while (r - l > 1) {
    int mid = (r + l) / 2;
    if (ok(cnt, n, mid, k).first) {
      l = mid;
    } else {
      r = mid;
    }
  }
  auto answer = ok(cnt, n, l, k, 1).second;
  if (l == 0) {
    for (int i = 1; i <= k; ++i) cout << i << " ";
    return 0;
  }
  for (auto &it : answer) {
    it = cc[it];
  }
  answer.resize(k);
  for (auto it : answer) {
    cout << it << " ";
  }
  return 0;
}
