#include <bits/stdc++.h>
using namespace std;
int freq[200001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    int d;
    cin >> d;
    ++freq[d];
  }
  vector<pair<int, int> > mx;
  for (int i = 1; i < 200001; ++i)
    if (freq[i]) mx.push_back({freq[i], i});
  sort(mx.rbegin(), mx.rend());
  int l = 1, r = n;
  int ans = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    int c = 0;
    for (int i = 0; i < mx.size(); ++i) c += mx[i].first / mid;
    if (c >= k) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  vector<int> res;
  for (int i = 0; i < mx.size(); ++i) {
    int h = mx[i].first / ans;
    while (h--) res.push_back(mx[i].second);
  }
  for (int i = 0; i < k; ++i) cout << res[i] << " ";
  return 0;
}
