#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
map<long long, long long> m;
bool ok(long long mid, long long k) {
  v.clear();
  for (auto x : m) {
    long long sizeV = (long long)v.size();
    for (long long i = 0; i < min(x.second / mid, k - sizeV); i++) {
      v.push_back(x.first);
      if ((long long)v.size() == k) return true;
    }
    if ((long long)v.size() == k) return true;
  }
  if ((long long)v.size() == k)
    return true;
  else
    return false;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  long long l = 1, r = n;
  vector<long long> ans;
  long long best = 0;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (ok(mid, k)) {
      best = mid;
      l = mid + 1;
      v.clear();
    } else {
      r = mid - 1;
    }
  }
  ok(best, k);
  for (auto x : v) cout << x << " ";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}
