#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int mp[maxn];
int num[maxn], b[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n, k, cnt = 0;
  cin >> n >> k;
  memset(mp, 0, maxn);
  memset(num, 0, maxn);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (!mp[x]) {
      mp[x] = ++cnt;
      b[cnt] = x;
    }
    ++num[mp[x]];
  }
  int r = n, l = 1, mid;
  while (l <= r) {
    int ans = 0;
    mid = (l + r) >> 1;
    for (int i = 1; i <= cnt; i++) {
      ans += (num[i] / mid);
    }
    if (ans >= k) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  for (int i = 1; i <= cnt; i++) {
    while (num[i] >= r) {
      num[i] -= r;
      cout << b[i] << " ";
      if (!--k) return 0;
    }
  }
  return 0;
}
