#include <bits/stdc++.h>
using namespace std;
int n, k;
int c[200005];
pair<int, int> s[200005];
int h = 0;
int main() {
  memset(c, 0, sizeof(c));
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    int v;
    scanf("%d", &v);
    c[v]++;
  }
  for (int i = 1; i <= 200000; i++) {
    if (c[i]) {
      s[h++] = {c[i], i};
    }
  }
  sort(s, s + h, greater<pair<int, int>>());
  int l = s[k - 1].first;
  int r = s[0].first;
  while (l <= r) {
    int m = l + (r - l) / 2;
    int carry = 0;
    int i = -1;
    int cnt = 0;
    while (cnt < k) {
      if (carry >= m) {
        carry -= m;
        cnt++;
      } else {
        i++;
        carry = s[i].first;
        if (carry < m) {
          break;
        }
      }
    }
    if (cnt >= k) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  for (int i = -1, carry = 0, cnt = 0; cnt < k;) {
    if (carry < r) {
      i++;
      carry = s[i].first;
    }
    carry -= r;
    cnt++;
    printf("%d", s[i].second);
    if (cnt < k) {
      printf(" ");
    }
  }
  printf("\n");
  return (0);
}
