#include <bits/stdc++.h>
const int BIG = 1e5 + 55;
const int BIGG = 1e9 + 7;
const long long BIGGE = 1e12 + 55;
const double SML = (1e-7);
using namespace std;
int n, k, a[2 * BIG], fr[2 * BIG];
set<int> s;
pair<bool, vector<int> > check(int x) {
  int cnt = 0;
  vector<int> v;
  for (auto i : s) {
    if (fr[i] / x > 0) {
      int m = fr[i] / x;
      for (int j = 0; j < m; j++) v.push_back(i);
    }
  }
  if (v.size() >= k)
    return {1, v};
  else
    return {0, v};
}
vector<int> BS() {
  vector<int> v;
  int st = 1, ed = n, res, mid;
  while (st <= ed) {
    mid = (st + ed) / 2;
    pair<int, vector<int> > p = check(mid);
    if (p.first) {
      v = p.second;
      st = mid + 1;
      res = mid;
    } else
      ed = mid - 1;
  }
  return v;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    fr[a[i]]++;
    s.insert(a[i]);
  }
  vector<int> ans = BS();
  for (int i = 0; i < k; i++) cout << ans[i] << " ";
  return 0;
}
