#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, unsigned long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x;
    }
    y = y >> 1;
    x = x * x;
  }
  return res;
}
long long int powermod(long long int x, unsigned long long int y,
                       long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % p;
    }
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
map<long long int, long long int> m;
vector<pair<long long int, long long int> > vp;
long long int n, k;
bool check(long long int mi) {
  long long int x = 0;
  for (long long int i = (long long int)(0); i < (long long int)(vp.size());
       i++) {
    x += (vp[i].first / mi);
  }
  if (x >= k)
    return true;
  else
    return false;
}
int32_t main() {
  cin >> n >> k;
  for (long long int i = (long long int)(0); i < (long long int)(n); i++) {
    long long int t;
    cin >> t;
    m[t]++;
  }
  for (auto &val : m) {
    long long int a = val.second;
    long long int b = val.first;
    vp.push_back({a, b});
  }
  sort((vp).begin(), (vp).end());
  reverse((vp).begin(), (vp).end());
  long long int l = 1, r = n;
  while (l < r) {
    long long int mid = (l + r) / 2;
    if (check(mid))
      l = mid + 1;
    else
      r = mid;
  }
  long long int lim = r - 1;
  vector<long long int> ans;
  if (r == 1) {
    for (long long int i = (long long int)(0); i < (long long int)(vp.size());
         i++) {
      ans.push_back(vp[i].second);
    }
  } else
    for (long long int i = (long long int)(0); i < (long long int)(vp.size());
         i++) {
      long long int c = vp[i].first / lim;
      for (long long int j = (long long int)(0); j < (long long int)(c); j++)
        ans.push_back(vp[i].second);
    }
  for (long long int i = (long long int)(0); i < (long long int)(k); i++)
    cout << ans[i] << " ";
  return 0;
}
