#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
int n, k, l, r, mid, cnt[N];
bool check(int x) {
  int rez = 0;
  for (int i = 1; i < N; i++) rez += cnt[i] / x;
  if (rez >= k) return 1;
  return 0;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> r;
    cnt[r]++;
  }
  l = 1;
  r = n + 1;
  while (r - l > 1) {
    mid = r + l >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  r = 0;
  for (int i = 1; i < N; i++)
    while (r < k && cnt[i] >= l) {
      r++;
      cnt[i] -= l;
      cout << i << ' ';
    }
  cout << '\n';
  return 0;
}
