#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> a;
vector<long long> get_res(long long m) {
  vector<long long> res;
  for (long long i = 0; i < a.size(); ++i) {
    long long el = a[i].second;
    long long c = a[i].first;
    long long t = 0;
    while ((c / (t + 1)) >= m) {
      t++;
      res.push_back(el);
    }
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> s(n);
  for (long long i = 0; i < n; ++i) cin >> s[i];
  vector<long long> cnt(2e5 + 10);
  for (long long i = 0; i < n; ++i) cnt[s[i]]++;
  vector<pair<long long, long long>> v;
  for (long long i = 0; i < cnt.size(); ++i) v.emplace_back(cnt[i], i);
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (long long i = 0; i < v.size(); ++i) {
    if (v[i].first > 0) {
      a.push_back(v[i]);
    }
  }
  long long l = 1;
  long long r = n + 1;
  while (l + 1 < r) {
    long long m = (l + r) / 2;
    if (get_res(m).size() >= k)
      l = m;
    else
      r = m;
  }
  auto res = get_res(l);
  for (long long i = 0; i < k; ++i) cout << res[i] << " ";
}
