#include <bits/stdc++.h>
using namespace std;
bool check(int c, multimap<int, int> v, int k) {
  int len = 0;
  for (auto i = v.begin(); i != v.end(); ++i) {
    len += i->first / c;
  }
  if (len >= k) {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  map<int, int> hash;
  for (int i = 0; i < n; ++i) {
    int val;
    cin >> val;
    hash[val]++;
  }
  multimap<int, int> v;
  for (auto i = hash.begin(); i != hash.end(); ++i) {
    v.insert(make_pair(i->second, i->first));
  }
  int start = 1;
  int end = n / k;
  int goodlen = -1;
  while (start <= end) {
    int mid = (start + end) / 2;
    bool res = check(mid, v, k);
    if (res) {
      goodlen = mid;
      start = mid + 1;
    } else {
      end = mid - 1;
    }
  }
  for (auto i = v.rbegin(); i != v.rend(); ++i) {
    int c = i->first / goodlen;
    c = min(c, k);
    for (int j = 0; j < c; ++j) {
      cout << i->second << " ";
    }
    k -= c;
    if (k < 0) {
      break;
    }
  }
  return 0;
}
