#include <bits/stdc++.h>
using namespace std;
long long n, k, a[200005];
long long cnt[200005];
map<long long, long long> ma;
pair<long long, long long> p[200005];
bool ch(int mid) {
  int ans = 0;
  for (int i = 0; i <= 200000; i++) {
    ans += (p[i].first / mid);
  }
  return ans >= k;
}
long long bs(int l, int h) {
  if (l > h) return -1;
  int mid = (l + h) / 2;
  if (ch(mid) && (!ch(mid + 1))) return mid;
  if (ch(mid)) return bs(mid + 1, h);
  return bs(l, mid - 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ma[a[i]]++;
    p[a[i]].first++;
    p[a[i]].second = a[i];
  }
  sort(p, p + 200001);
  int u = 0;
  vector<long long> v;
  long long o = bs(1, 200005);
  bool bla = 0;
  for (int i = 200000; i >= 1; i--) {
    if (bla) break;
    for (int j = 0; j < p[i].first / o; j++) {
      v.push_back(p[i].second);
      if (v.size() == k) {
        bla = 1;
        break;
      }
    }
  }
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  return 0;
}
