#include <bits/stdc++.h>
using namespace std;
bool f(vector<pair<long long, long long> > v1, long long mid, long long k,
       long long h);
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n], i, b[n], h = 0, j;
  map<long long, long long> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  sort(a, a + n);
  for (i = 0; i < n - 1; i++) {
    if (a[i] != a[i + 1]) {
      b[h] = a[i];
      h++;
    }
  }
  b[h] = a[n - 1];
  h++;
  vector<pair<long long, long long> > v;
  for (i = 0; i < h; i++) v.push_back(make_pair(m[b[i]], b[i]));
  stable_sort(v.begin(), v.end());
  vector<pair<long long, long long> > v1;
  for (i = h - 1; i >= 0; i--) {
    v1.push_back(make_pair(v[i].first, v[i].second));
  }
  long long l = 1, r = n / k, mid;
  while (l < r) {
    mid = l + (r - l + 1) / 2;
    if (f(v1, mid, k, h) == 1)
      l = mid;
    else
      r = mid - 1;
  }
  long long d[h], z = 0;
  for (i = 0; i < h; i++) {
    long long g = v1[i].first / l;
    for (j = 0; j < g; j++) {
      d[z] = v1[i].second;
      z++;
      if (z == k) {
        i = h;
        j = g;
      }
    }
  }
  for (i = 0; i < z; i++) cout << d[i] << " ";
  return 0;
}
bool f(vector<pair<long long, long long> > v1, long long mid, long long k,
       long long h) {
  long long i, sum = 0;
  for (i = 0; i < h; i++) {
    sum += v1[i].first / mid;
  }
  if (sum >= k)
    return 1;
  else
    return 0;
}
