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