#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n, m, x, r, c = 0, t, l, k = 0, g, h = 0, d;
  cin >> n >> k;
  map<int64_t, int64_t> p;
  int64_t a[n + 10], b[n + 10];
  t = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    p[a[i]]++;
    if (p[a[i]] == 1) {
      b[t++] = a[i];
    }
  }
  l = 1, r = n;
  while (l <= r) {
    m = (l + r) / 2;
    c = k;
    if (l == r) {
      h++;
      if (h == 2) {
        break;
      }
    }
    for (int i = 0; i < t; i++) {
      x = p[b[i]];
      if (c == 0) {
        break;
      }
      if (x >= m) {
        d = x / m;
        d = min(d, c);
        c -= d;
      }
    }
    if (c == 0) {
      g = m;
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  for (int i = 0; i < t; i++) {
    x = p[b[i]];
    if (k == 0) {
      break;
    }
    if (x >= g) {
      d = x / g;
      d = min(d, k);
      for (int j = 1; j <= d; j++) {
        cout << b[i] << " ";
      }
      k -= d;
    }
  }
}
