#include <bits/stdc++.h>
using namespace std;
bool fun(long long a[], long long k, long long n, long long m) {
  long long i = 0;
  for (long long j = 0; j < n; j++) {
    i += a[j] / k;
    if (i >= m) return true;
  }
  return false;
}
int32_t main() {
  long long n, k, i, j, l;
  cin >> n >> k;
  long long high = n / k;
  long long a[n];
  map<long long, long long> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  n = m.size();
  long long b[n];
  i = 0;
  for (auto it = m.begin(); it != m.end(); it++) {
    b[i] = (it->second);
    i++;
  }
  vector<pair<long long, long long> > v;
  for (auto it = m.begin(); it != m.end(); it++) {
    j = (it->second);
    i = (it->first);
    v.push_back({j, i});
  }
  long long low = 1, mid;
  while (high >= low) {
    mid = (low + high) / 2;
    if (fun(b, mid, n, k))
      low = mid + 1;
    else
      high = mid - 1;
  }
  high = low - 1;
  l = 0;
  bool hi = false;
  for (i = 0; i < v.size(); i++) {
    for (j = 1; j <= (v[i].first) / high; j++) {
      if (l == k) {
        hi = true;
        break;
      }
      cout << v[i].second << " ";
      l++;
    }
    if (hi) break;
  }
  return 0;
}
