#include <bits/stdc++.h>
using namespace std;
struct bpair {
  long long int num;
  long long int ind;
};
bool compareB(bpair a, bpair b) { return a.num > b.num; }
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<bpair> freq(200000);
  for (int i = 0; i < 200000; i++) {
    freq[i].num = 0;
    freq[i].ind = i + 1;
  }
  long long int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    freq[a - 1].num++;
  }
  sort(freq.begin(), freq.end(), compareB);
  vector<long long int> out;
  long long int currt;
  long long int low = 0, high = n, el = n / 2;
  long long int nofe = 0, spot = 0;
  while (el != low) {
    spot = 0;
    nofe = 0;
    while (nofe < k && spot < n) {
      nofe += (freq[spot].num) / el;
      spot++;
    }
    if (nofe >= k) {
      low = el;
    } else {
      high = el;
    }
    el = (low + high) / 2;
  }
  if (high != el) {
    spot = 0;
    nofe = 0;
    while (nofe < k && spot < n) {
      nofe += (freq[spot].num) / high;
      spot++;
    }
  }
  if (nofe >= k) {
    el = high;
  }
  vector<long long int> finalout;
  spot = 0;
  nofe = 0;
  while (nofe < k && spot < n) {
    nofe += (freq[spot].num) / el;
    for (int l = 0; l < (freq[spot].num) / el; l++) {
      finalout.push_back(freq[spot].ind);
    }
    spot++;
  }
  for (int i = 0; i < k; i++) {
    cout << finalout[i] << " ";
  }
  cout << '\n';
  return 0;
}
