#include <bits/stdc++.h>
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 1e7 + 5, MOD = 1e9;
using namespace std;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
bool valid(map<long long, long long>& mp, long long mid, long long k) {
  map<long long, long long>::iterator it;
  long long cnt = 0;
  for (it = mp.begin(); it != mp.end(); it++) {
    if (mid > 0) {
      long long z = it->second / mid;
      cnt += z;
    }
  }
  return cnt >= k;
}
int main() {
  fast();
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  map<long long, long long> mp;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    mp[v[i]]++;
  }
  long long s = 0, e = 1e6, mid = 0, ans = 0;
  while (s <= e) {
    mid = (s + e) / 2;
    if (valid(mp, mid, k)) {
      ans = mid;
      s = mid + 1;
    } else
      e = mid - 1;
  }
  if (ans == 0) {
    for (int i = 0; i < k; i++) cout << v[i] << " ";
  } else {
    long long cnt = 0;
    map<long long, long long>::iterator it;
    for (it = mp.begin(); it != mp.end(); it++) {
      long long z = it->second / ans;
      if (cnt + z > k) z = k - cnt;
      cnt += z;
      for (int i = 0; i < z; i++) cout << it->first << " ";
    }
  }
  return 0;
}
