#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> v;
long long freq[200006] = {};
long long arr[200006] = {};
long long check(long long x) {
  long long total = 0;
  for (long long i = 1; i < 200006; i++) {
    total += freq[i] / x;
    if (total >= k) return 1;
  }
  return 0;
}
void compute(long long x) {
  long long total = k;
  for (int i = 1; i < 200006; i++) {
    long long curr = min(total, freq[i] / x);
    total -= curr;
    for (long long j = 1; j <= curr; j++) v.push_back(i);
  }
}
long long Bsearch(long long low, long long high) {
  while (low < high) {
    long long mid = (low + high + 1) / 2;
    if (check(mid))
      low = mid;
    else
      high = mid - 1;
  }
  return low;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    freq[arr[i]]++;
  }
  long long ans = Bsearch(1, n / k);
  compute(ans);
  for (long long i = 0; i < v.size(); i++) cout << v[i] << ' ';
}
