#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
vector<int> loul;
int f[N], k;
bool ok(int val) {
  int x(0);
  for (int i = 0; i < loul.size(); ++i) x += f[loul[i]] / val;
  return x >= k;
}
int bs() {
  int pas = 1 << 17, r(0);
  while (pas) {
    if (ok(r + pas)) r += pas;
    pas >>= 1;
  }
  return r;
}
int main() {
  int n, val, stn(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> val;
    ++f[val];
    if (f[val] == 1) loul.push_back(val);
  }
  int x = bs();
  for (int i = 0; i < loul.size() && stn < k; ++i)
    for (int p = 1; p * x <= f[loul[i]] && stn < k; ++p)
      ++stn, cout << loul[i] << ' ';
  return 0;
}
