#include <bits/stdc++.h>
using namespace std;
const long long maxv = 2e5 + 1;
long long n, k;
set<pair<long long, long long> > b;
vector<long long> res;
void start() {
  cin >> n >> k;
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    mp[x]++;
  }
  for (auto i : mp) {
    b.insert({i.second, i.first});
  }
}
bool check(long long val) {
  res.clear();
  long long temp;
  for (auto it = b.end(); it-- != b.begin();) {
    long long temp = (*it).first / val;
    if (temp) {
      for (long long j = 0; j < temp; j++) {
        res.push_back((*it).second);
        if (res.size() == k) return true;
      }
    } else
      return false;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  start();
  long long l = 0, r = maxv;
  while (l + 1 < r) {
    long long m = l + r >> 1;
    if (check(m))
      l = m;
    else
      r = m;
  }
  check(l);
  for (auto i : res) cout << i << ' ';
}
