#include <bits/stdc++.h>
using namespace std;
const int sizee = 2e5 + 5;
int n, k;
int N[sizee];
int freq[sizee];
vector<int> v;
bool i_can(int cop) {
  v.clear();
  for (int i = 1; i < sizee; i++) {
    int need = floor(freq[i] / cop);
    for (int j = 1; j <= need; j++) {
      v.push_back(i);
      if (v.size() == k) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> N[i];
    ++freq[N[i]];
  }
  int L = 1, R = 2e5 + 5;
  int mid = 0;
  int K = 0;
  while (L <= R) {
    mid = (L + R) >> 1;
    if (i_can(mid)) {
      L = mid + 1;
      K = mid;
    } else {
      R = mid - 1;
    }
  }
  i_can(K);
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  return 0;
}
