#include <bits/stdc++.h>
using namespace std;
const int max_n = 2000005;
int n, k, x, i, j, m, t;
int a[max_n];
vector<pair<int, int>> v;
int main() {
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> x;
    a[x]++;
  }
  for (i = 1; i < max_n; i++) {
    for (j = 1; j <= a[i]; j++) {
      v.push_back({a[i] / j, i});
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (i = 0; i < k; i++) {
    cout << v[i].second << " ";
  }
}
