#include <bits/stdc++.h>
bool can(int val, int k, std::map<int, int>& freq, std::vector<int>& result) {
  result.clear();
  for (auto p : freq) {
    int num = std::min(p.second / val, k - (int)result.size());
    for (int i = 0; i < num; i++) {
      result.push_back(p.first);
      if (result.size() == k) return true;
    }
  }
  return false;
}
int main() {
  int n, k;
  std::cin >> n >> k;
  int s[200000];
  std::map<int, int> freq;
  for (int i = 0; i < n; i++) {
    std::cin >> s[i];
    freq.find(s[i]) == freq.end() ? freq[s[i]] = 1 : freq[s[i]]++;
  }
  std::vector<int> result;
  int lo = 1, hi = n;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if (can(mid, k, freq, result)) {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  if (!can(lo, k, freq, result)) can(lo - 1, k, freq, result);
  for (int x : result) {
    std::cout << x << " ";
  }
  std::cout << "\n";
  return 0;
}
