#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int a[300000];
int n, k;
int b[300000];
int cnt = 0;
int cmp(int a, int b) { return mp[a] > mp[b]; }
bool check(int mid) {
  int sum = 0;
  for (int i = 1; i <= cnt; i++) {
    sum += mp[b[i]] / mid;
  }
  return sum >= k;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    if (!mp[a[i]]) b[++cnt] = a[i];
    mp[a[i]]++;
  }
  int l = 1;
  int r = 250000;
  int ans;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  int nd = k;
  int now = 1;
  sort(b + 1, b + 1 + cnt);
  while (nd) {
    while (nd && mp[b[now]] >= ans)
      cout << b[now] << " ", mp[b[now]] -= ans, nd--;
    now++;
  }
  return 0;
}
