#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, k;
map<int, int> a;
vector<int> ans;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;
    a[ai] += 1;
  }
  int l = 1;
  int r = n;
  while (l <= r) {
    int m = (l + r) / 2;
    int kk = k;
    for (auto it : a) {
      kk -= it.second / m;
      if (kk <= 0) break;
    }
    if (kk <= 0) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  for (auto it : a) {
    for (int i = 0; i < (it.second / r); i++) {
      ans.push_back(it.first);
      k -= 1;
      if (k == 0) break;
    }
    if (k == 0) break;
  }
  for (auto it : ans) cout << it << ' ';
  cout << endl;
  return 0;
}
