#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = (int)2e5 + 7, mod = 1000000007, M = 2e9;
int n, k, t, f[N], st, en = N, mid;
vector<pair<int, int> > x;
vector<int> ans;
bool can() {
  int c = 0;
  for (pair<int, int> i : x) c += i.first / mid;
  return c >= k;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    f[t]++;
  }
  for (int i = 1; i < N; i++) {
    if (f[i]) x.push_back({f[i], i});
  }
  sort(x.begin(), x.end());
  reverse(x.begin(), x.end());
  while (st < en) {
    mid = (st + en + 1) >> 1;
    if (can())
      st = mid;
    else
      en = mid - 1;
  }
  for (pair<int, int> i : x) {
    t = i.first / st;
    while (t--) ans.push_back(i.second);
  }
  for (int i = 0; i < k; i++) printf("%d ", ans[i]);
  return 0;
}
