#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  map<int, int> freq;
  vector<pair<int, int>> vec;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    freq[in]++;
  }
  for (auto &x : freq) vec.push_back({x.second, x.first});
  sort(vec.rbegin(), vec.rend());
  int l = 1, r = 1e6, take = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    int cnt = 0;
    for (int i = 0; i < vec.size(); i++) cnt += vec[i].first / mid;
    if (cnt >= k)
      l = mid + 1, take = mid;
    else
      r = mid - 1;
  }
  int cnt = 0;
  for (int i = 0; i < vec.size(); i++) {
    for (int j = 0; j < vec[i].first / take; j++) {
      if (cnt == k) break;
      cout << vec[i].second << ' ';
      cnt++;
    }
  }
  return 0;
}
