#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, c, m1 = 0, m2 = 0, s = 0, m, x;
  cin >> n >> k;
  priority_queue<pair<long long, long long> > pq;
  unordered_map<long long, long long> mp;
  for (i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    pq.push({it->second, it->first});
    for (j = 2; j <= it->second; j++) {
      pq.push({it->second / j, it->first});
    }
  }
  while (k--) {
    cout << pq.top().second << ' ';
    pq.pop();
  }
}
