#include <bits/stdc++.h>
using namespace std;
long long f[200002], n, x, k;
vector<pair<long long, long long>> v;
bool ok(int x) {
  int t = k;
  for (int i = v.size() - 1; i >= 0 && t > 0; i--) {
    t -= v[i].first / x;
  }
  return (t <= 0);
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    f[x]++;
  }
  for (int i = 1; i <= 200000; i++)
    if (f[i]) v.push_back({f[i], i});
  sort(v.begin(), v.end());
  int st = 1, dr = n / k, ans = 0;
  while (st <= dr) {
    int mij = (st + dr) / 2;
    if (ok(mij)) {
      st = mij + 1;
      ans = mij;
    } else
      dr = mij - 1;
  }
  int t = k;
  for (int i = v.size() - 1; i >= 0 && t > 0; i--) {
    for (int j = 0; j < v[i].first / ans && t; j++) {
      cout << v[i].second << " ";
      t--;
    }
  }
  return 0;
}
