#include <bits/stdc++.h>
using namespace std;
void print_map(map<long long, long long> a) {
  for (auto i : a) {
    cout << i.first << " " << i.second << '\n';
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> k;
  vector<long long> ans;
  vector<long long> spisok(n);
  map<long long, long long> check, check1;
  map<pair<long long, long long>, pair<long long, long long>> dict;
  vector<pair<long long, long long>> olala;
  for (int i = 0; i < n; ++i) {
    cin >> spisok[i];
    check1[spisok[i]] = 1;
    check[spisok[i]]++;
  }
  for (auto i : check) {
    dict[{-i.second, i.first}] = {i.second, 1};
  }
  for (int i = 0; i < k; ++i) {
    for (auto j : dict) {
      ans.push_back(j.first.second);
      if (j.first.first == -(j.second.first / (j.second.second + 1))) {
        dict[{-(j.second.first / (j.second.second + 1)), j.first.second}] = {
            j.second.first, j.second.second + 1};
      } else {
        dict[{-(j.second.first / (j.second.second + 1)), j.first.second}] = {
            j.second.first, j.second.second + 1};
        dict.erase({j.first.first, j.first.second});
      }
      break;
    }
  }
  for (auto i : ans) {
    cout << i << " ";
  }
  return 0;
}
