#include <bits/stdc++.h>
using namespace std;
bool check(long long k, long long mid, map<long long, long long> &m) {
  long long ans = 0;
  for (auto it : m) ans += it.second / mid;
  return ans >= k;
}
signed main() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    m[x]++;
  }
  long long low = 1, high = n;
  long long ans = 1;
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (check(k, mid, m))
      ans = mid, low = mid + 1;
    else
      high = mid - 1;
  }
  long long t = 0;
  for (auto &it : m) {
    while (it.second >= ans) {
      if (t < k) {
        cout << it.first << " ";
        it.second -= ans;
        t++;
      } else
        break;
    }
  }
  cout << "\n";
}
