#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, cnt = 0, ans = 0, c, l, r, mid;
  cin >> n >> m;
  vector<long long> v(200001), a;
  pair<long long, long long> p[200001];
  for (i = 0; i < n; i++) {
    cin >> c;
    v[c]++;
  }
  for (i = 0; i <= 200000; i++) {
    p[i].first = i;
    p[i].second = v[i];
  }
  sort(v.begin(), v.end(), greater<long long>());
  r = v[0];
  l = 1;
  while (l <= r) {
    mid = (l + r) / 2;
    cnt = 0;
    for (i = 0; i <= 200000 && v[i] > 0; i++) {
      cnt += v[i] / mid;
    }
    if (cnt >= m) {
      ans = max(ans, mid);
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cnt = 0;
  for (i = 0; i <= 200001; i++) {
    long long x = p[i].second / ans;
    if (x) {
      for (long long j = 0; j < x; j++) {
        if (cnt == m) break;
        cout << i << " ";
        cnt++;
      }
    }
    if (cnt == m) break;
  }
  cout << "\n";
}
