#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 7;
const long long INF = 1e17;
int n, k;
int a[N], b[N], mx;
int f(int x) {
  int re = 0;
  for (int i = 1; i <= mx; i++) {
    re += b[i] / x;
  }
  if (re >= k) return 1;
  return 0;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
    b[a[i]]++;
  }
  int l = 0, r = 1e8, ans = 0;
  while (l <= r) {
    int mid = l + r >> 1;
    if (f(mid))
      ans = max(mid, ans), l = mid + 1;
    else
      r = mid - 1;
  }
  while (f(ans + 1)) ans++;
  int cnt = 0;
  for (int i = 1; i <= mx; i++) {
    while (b[i] >= ans && b[i] > 0) {
      cnt++;
      b[i] -= ans;
      printf("%d ", i);
      if (cnt == k) return 0;
    }
  }
  return 0;
}
