#include <bits/stdc++.h>
template <class t>
void maxi(t &x, t y) {
  if (x < y) x = y;
}
template <class t>
void mini(t &x, t y) {
  if (x > y) x = y;
}
using namespace std;
int n, k;
vector<int> a(300005), cnt(300005), fa;
bool solve(int to) {
  int ans = 0;
  for (int(i) = 1; (i) <= (300005 - 1); (i)++) {
    if (cnt[i]) {
      ans += cnt[i] / to;
    }
  }
  return ans >= k;
}
void func(int to) {
  int ans = 0;
  for (int(i) = 1; (i) <= (300005 - 1); (i)++) {
    for (int(j) = 0; (j) < (cnt[i] / to); (j)++) {
      fa.push_back(i);
      ans++;
      if (ans >= k) break;
    }
    if (ans >= k) break;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int l = 1, r = n;
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (solve(mid))
      l = mid;
    else
      r = mid - 1;
  }
  func(l);
  for (int(i) = 0; (i) < (fa.size()); (i)++) cout << fa[i] << ' ';
  cout << endl;
  ;
  return 0;
}
