#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200005];
map<int, int> M;
int Ans[200005];
bool check(int m) {
  vector<int> t;
  map<int, int> t_m;
  t_m = M;
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (t_m[a[i]] >= m) {
      t_m[a[i]] -= m;
      c++;
      t.push_back(a[i]);
    }
  }
  if (c >= k) {
    for (int i = 0; i < k; i++) Ans[i] = t[i];
    return 1;
  } else
    return 0;
}
int BS(int l, int r) {
  int ans = 0;
  while (l <= r) {
    int m = (l + r) / 2;
    if (check(m))
      ans = m, l = m + 1;
    else
      r = m - 1;
  }
  return ans;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    M[a[i]]++;
  }
  BS(0, n);
  for (int i = 0; i < k; i++) {
    cout << Ans[i] << ' ';
  }
  return 0;
}
