#include <bits/stdc++.h>
using namespace std;
const int N = 1e6, INF = 1e5 + 3;
int a[N + 5];
int cnt[N + 5];
vector<int> ans;
int n, k;
bool check(int x) {
  ans.clear();
  for (int i = 0; i < 2 * INF; i++) {
    int aux = min(cnt[i] / x, k - int(ans.size()));
    for (int j = 0; j < aux; j++) {
      ans.push_back(i);
    }
  }
  return ans.size() == k;
}
void bs(long long i, long long j) {
  long long mid;
  while (j > i + 1) {
    mid = (i + j) >> 1;
    if (check(mid))
      i = mid;
    else
      j = mid;
  }
  if (!check(j)) check(i);
  for (auto it : ans) cout << it << " ";
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  bs(0, n);
  return 0;
}
