#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  map<long long, int> cnt;
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    cnt[tmp]++;
  }
  map<int, int> arr;
  for (auto i : cnt) arr[i.second]++;
  int l = 0, r = n, m, cur;
  while (l < r) {
    m = (l + r + 1) >> 1;
    cur = 0;
    for (auto it = arr.rbegin(); it != arr.rend(); it++)
      cur += (it->first / m) * it->second;
    if (cur >= k)
      l = m;
    else
      r = m - 1;
  }
  for (auto i : cnt) {
    while (i.second >= l && k) {
      cout << i.first << " ";
      i.second -= l;
      k--;
    }
    if (!k) break;
  }
  cout << '\n';
  return 0;
}
