#include <bits/stdc++.h>
using namespace std;
namespace _ {
bool rEOF = 1;
inline char nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && rEOF &&
                 (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? (rEOF = 0, EOF)
             : *p1++;
}
template <class _T>
inline bool read(_T &num) {
  char c = nc(), f = 1;
  num = 0;
  while (c < '0' || c > '9') c == '-' && (f = -1), c = nc();
  while (c >= '0' && c <= '9') num = num * 10 + c - '0', c = nc();
  return (bool)(num *= f);
}
inline bool need(char &c) {
  return c >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c >= 'A' && c <= 'Z';
}
inline bool read_str(char *a) {
  while ((*a = nc()) && need(*a) && rEOF) ++a;
  *a = '\0';
  return rEOF;
}
}  // namespace _
using namespace _;
int n, k;
int a[200005];
bool ck(int x) {
  int g = 0;
  for (int i = 1; i <= 200001; i++) {
    if (a[i] == 0) continue;
    g += a[i] / x;
  }
  return g >= k;
}
int main() {
  scanf("%d%d", &n, &k);
  int r, l = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    r = max(a[x], r);
  }
  r++;
  int ans = -1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (ck(mid)) {
      l = mid + 1;
      ans = mid;
    } else
      r = mid;
  }
  int cnt = 0;
  for (int i = 1; i <= 200001; i++) {
    while (a[i] - ans >= 0) {
      printf("%d ", i);
      cnt++;
      a[i] = a[i] - ans;
      if (cnt >= k) break;
    }
    if (cnt >= k) break;
  }
  printf("\n");
  return 0;
}
