#include <bits/stdc++.h>
using namespace std;
long long a[202202], us[202202];
vector<long long> dp;
vector<pair<long long, long long> > v;
vector<long long> g;
long long n, k, kol;
int chek(long long mid) {
  kol = 0;
  for (long long i = 0; i < v.size(); i++) {
    long long x = v[i].first;
    kol += x / mid;
  }
  if (kol >= k)
    return 1;
  else
    return 0;
}
void ans(long long mid) {
  kol = 0;
  for (long long i = 0; i < v.size(); i++) {
    long long x = v[i].first;
    kol += x / mid;
    for (long long j = 1; j <= x / mid; j++) {
      g.push_back(v[i].second);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    if (us[a[i]] == 0) dp.push_back(a[i]);
    us[a[i]]++;
  }
  for (long long i = 0; i < dp.size(); i++) {
    v.push_back({us[dp[i]], dp[i]});
  }
  sort(v.begin(), v.end());
  long long l = 1, r = 1000000;
  while (l + 1 < r) {
    long long mid = (l + r) / 2;
    if (chek(mid) == 1)
      l = mid;
    else
      r = mid;
  }
  if (chek(r) == 1) {
    ans(r);
    for (long long i = 0; i < k; i++) {
      cout << g[i] << ' ';
    }
  } else {
    ans(l);
    for (long long i = 0; i < k; i++) {
      cout << g[i] << ' ';
    }
  }
  return 0;
}
