#include <bits/stdc++.h>
using namespace std;
int cnt[200001];
void solve() {
  int n, k;
  cin >> n >> k;
  int ss[n];
  for (int i = 0; i < n; i++) cin >> ss[i], cnt[ss[i]]++;
  vector<pair<int, int>> v;
  vector<int> ans;
  for (int i = 1; i <= 200000; i++) {
    if (cnt[i]) v.push_back({cnt[i], i});
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int cop = n;
  for (cop = n; cop >= 0; cop--) {
    int d = 0;
    int i = 0;
    while (d < k && i < v.size()) {
      if (v[i].first / cop == 0) break;
      d += (v[i].first / cop);
      i++;
    }
    if (d >= k) {
      d = 0;
      i = 0;
      while (d < k && i < v.size()) {
        int t = v[i].first / cop;
        while (t--) ans.push_back(v[i].second);
        d += (v[i].first / cop);
        i++;
      }
      break;
    }
  }
  for (int i = 0; i < k; i++) cout << ans[i] << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt = 1;
  while (tt--) solve();
  return 0;
}
