#include <bits/stdc++.h>
using namespace std;
int freq[212345];
vector<int> resp;
int n, k;
int verifica(int val) {
  int cont = 0;
  for (int i = 1; i <= 200000; i++) cont += (freq[i] / val);
  return cont;
}
int bs() {
  int l, r, freq;
  l = 1;
  r = 200001;
  while (l < r - 1) {
    freq = l + (r - l) / 2;
    int cont = verifica(freq);
    if (cont == k) return freq;
    if (cont > k) l = freq;
    if (cont < k) r = freq;
  }
  return l;
}
int main() {
  cin >> n >> k;
  int aux;
  for (int i = 0; i < n; i++) {
    cin >> aux;
    freq[aux]++;
  }
  int frequencia = bs();
  int cont = 0;
  for (int i = 1; i <= 200000; i++) {
    if (freq[i] / frequencia != 0)
      for (int j = 0; j < freq[i] / frequencia && cont < k; j++) {
        resp.push_back(i);
        cont++;
      }
    if (cont == k) break;
  }
  for (auto x : resp) cout << x << " ";
  cout << "\n";
  return 0;
}
