#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int main() {
  int n = 0;
  int k = 0;
  cin >> n >> k;
  vector<int> a(n, 0);
  vector<int> cnt(maxn, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int l = 1;
  int r = n + 1;
  while (r - l > 1) {
    int mid = (r + l) >> 1;
    long long ans = 0;
    for (int x = 1; x < maxn; x++) {
      ans += cnt[x] / mid;
    }
    if (ans >= k) {
      l = mid;
    } else {
      r = mid;
    }
  }
  for (int i = 1; i < maxn; i++) {
    int u = cnt[i] / l;
    for (int j = 0; j < min(u, k); j++) {
      cout << i << " ";
    }
    k -= u;
  }
  return 0;
}
