#include <bits/stdc++.h>
using namespace std;
int n, k;
int cnt[200005] = {0};
set<int> s;
int val = 0;
bool can(int mid) {
  val = 0;
  for (auto i : s) {
    val += cnt[i] / mid;
  }
  if (val >= k) return true;
  return false;
}
int main() {
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    s.insert(a[i]);
    cnt[a[i]]++;
  }
  int ans = 0;
  int l = 1, r = n;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (!can(mid)) {
      r = mid - 1;
    } else {
      l = mid + 1;
      ans = mid;
    }
  }
  int count = 0;
  for (auto i : s) {
    if (count < k) {
      for (int j = 0; j < cnt[i] / ans; ++j) {
        cout << i << " ";
        count++;
        if (count == k) break;
      }
    }
    if (count == k) break;
  }
}
