#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1123456;
const int MAXINT = 2147483098;
const long long MAXLL = 9223372036854775258LL;
vector<pair<long long, long long> > v;
int cnt[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, MAX = 2e5;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  for (int i = 1; i <= MAX; ++i) {
    for (int j = 1; j <= cnt[i]; ++j) v.push_back(make_pair(cnt[i] / j, i));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < k; ++i) cout << v[i].second << " ";
  return 0;
}
