#include <bits/stdc++.h>
using namespace std;
int n;
int c[2 * 100010], f[2 * 100010], k;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n >> k;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
    f[x]++;
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 1; i <= 2 * 100005; i++) {
    if (f[i]) {
      pq.push(make_pair(f[i], i));
    }
  }
  vector<int> ans;
  for (int i = 0; i < k; i++) {
    pair<int, int> x = pq.top();
    pq.pop();
    c[x.second]++;
    ans.push_back(x.second);
    pq.push(make_pair(f[x.second] / (c[x.second] + 1), x.second));
  }
  for (auto i : ans) {
    cout << i << ' ';
  }
  return 0;
}
