#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long int mod = 1e9 + 7;
vector<pair<long int, long int> > a;
long int i, j, n, k, l, t, low, high, mid;
map<long int, long int> b;
vector<long int> c;
bool go(long int ind) {
  long int ans = 0;
  for (long int i = 0; i < a.size(); i++) ans += (a[i].first / ind);
  if (ans >= k) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long int res = 1;
  cin >> n >> k;
  for (long int i = 0; i < n; i++) {
    cin >> j;
    b[j]++;
  }
  for (auto i : b) a.push_back(make_pair(i.second, i.first));
  sort(a.rbegin(), a.rend());
  low = 1;
  high = (n / k) + 1;
  while (high - low > 1) {
    mid = (low + high) / 2;
    if (go(mid)) {
      res = max(res, mid);
      low = mid;
    } else
      high = mid;
  }
  for (long int i = 0; i < a.size(); i++) {
    j = a[i].first / res;
    for (long int l = 0; l < j; l++) c.push_back(a[i].second);
  }
  for (long int i = 0; i < k; i++) cout << c[i] << " ";
  return 0;
}
