#include <bits/stdc++.h>
using namespace std;
long n, k, i, j, x;
map<long, long> b;
priority_queue<pair<long, long> > c;
int main() {
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> x;
    b[x]++;
  }
  for (i = 0; i < b.size(); i++)
    if (b[i] != 0)
      for (j = 1; j <= b[i]; j++) c.push(make_pair(b[i] / j, i));
  for (i = 0; i < k; i++) {
    cout << c.top().second << " ";
    c.pop();
  }
  return 0;
}
