#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
vector<long long> ans;
long long cnt[200005] = {0};
long long k;
bool check(long long x, long long arr[]) {
  vector<long long> temp;
  for (long long i = 1; i <= 200000; i++) {
    long long j = cnt[i] / x;
    long long l = 0;
    for (long long kk = 0; kk < j; kk++) {
      if (temp.size() < k)
        temp.push_back(i);
      else {
        l = 1;
        break;
      }
    }
    if (l) break;
  }
  if (temp.size() == k) {
    ans.clear();
    for (long long i = 0; i < temp.size(); i++) ans.push_back(temp[i]);
    return true;
  }
  return false;
}
int main() {
  long long n;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long low = 1, high = n;
  for (long long i = 0; i < n; i++) {
    cnt[arr[i]]++;
  }
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (check(mid, arr)) {
      low = mid + 1;
    } else
      high = mid - 1;
  }
  for (long long i = 0; i < k; i++) {
    cout << ans[i] << " ";
  }
}
