#include <bits/stdc++.h>
using namespace std;
long long n, k, arr[2000000], mx, mxx, kek;
pair<long long, long long> m[1000000];
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second > b.second;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mx = max(mx, arr[i]);
  }
  for (int i = 0; i < n; i++) {
    m[arr[i]].first = arr[i];
    m[arr[i]].second++;
  }
  sort(m, m + mx + 1, cmp);
  long long l = 1, r = n;
  while (r > l) {
    long long mid = (r + l + 1) / 2;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      ans += m[i].second / mid;
    }
    if (ans > k)
      l = mid;
    else if (ans < k)
      r = mid - 1;
    else if (ans == k)
      l = mid;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m[i].second / l; j++) {
      if (kek == k) return 0;
      cout << m[i].first << ' ';
      kek++;
    }
  }
}
