#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second > p2.second;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  map<long long, long long> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  vector<pair<long long, long long> > v;
  for (auto x : m) {
    v.push_back(make_pair(x.first, x.second));
  }
  sort(v.begin(), v.end(), comp);
  long long ans[v.size()];
  for (int i = 0; i < v.size(); i++) ans[i] = 0;
  ans[0] = v[0].second / k;
  int prefix[v.size()];
  prefix[0] = v[0].second;
  for (int i = 1; i < v.size(); i++) {
    prefix[i] = v[i].second + prefix[i - 1];
  }
  for (int i = 1; i < v.size(); i++) {
    long long valuable = prefix[i];
    ans[i] = max({ans[i - 1], min(valuable / k, v[i].second)});
  }
  int maxc = ans[v.size() - 1];
  vector<long long> sol;
  for (int c = maxc; c >= 1; c--) {
    for (auto x : v) {
      for (int i = 0; i < x.second / c; i++) {
        sol.push_back(x.first);
        if (sol.size() == k) break;
      }
      if (sol.size() == k) break;
    }
    if (sol.size() == k) break;
    sol.clear();
  }
  for (int i = 0; i < k; i++) {
    cout << sol[i] << " ";
  }
}
