#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long s[n];
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
    m[s[i]] += 1;
  }
  vector<pair<long long, long long>> v;
  for (auto i = m.begin(); i != m.end(); i++) {
    v.push_back(make_pair(i->second, i->first));
  }
  sort(v.begin(), v.end());
  long long ans;
  long long l = 1, r = n;
  while (l <= r) {
    long long mid = (l + r) / 2;
    long long count = 0;
    for (long long i = v.size() - 1; i >= 0; i--) {
      count += v[i].first / mid;
    }
    if (count >= k) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  vector<long long> final;
  for (long long i = 0; i < v.size(); i++) {
    for (long long j = 0; j < (v[i].first / ans); j++) {
      final.push_back(v[i].second);
    }
  }
  for (long long i = 0; i < k; i++) cout << final[i] << " ";
}
