#include <bits/stdc++.h>
using namespace std;
int a[200005];
vector<pair<int, int> > b;
int n, t;
int cnt[200005];
bool p[200005];
bool check(int k) {
  int res = 0;
  for (int i = 0; i <= (int)b.size() - 1; ++i) {
    res += b[i].first / k;
    if (res >= t) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) ++cnt[a[i]];
  for (int i = 1; i <= n; ++i)
    if (!p[a[i]]) b.push_back(make_pair(cnt[a[i]], a[i])), p[a[i]] = 1;
  sort(b.begin(), b.end(), greater<pair<int, int> >());
  int l = 0;
  int r = (n / t) + 1;
  while (l + 1 < r) {
    int m = (l + r) / 2;
    if (check(m))
      l = m;
    else
      r = m;
  }
  for (int i = 0; i <= b.size() - 1; ++i) {
    while (b[i].first >= l) {
      printf("%d ", b[i].second);
      b[i].first -= l;
      --t;
      if (!t) return 0;
    }
  }
  return 0;
}
