#include <bits/stdc++.h>
using namespace std;
int a[200005], r[200005], x[200005], n, m;
bool check(int k) {
  int ans = 0;
  for (int i = 1; i < 200005; i++) {
    ans += x[i] / k;
  }
  return ans >= m;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  memset(x, 0, sizeof(x));
  int L = 1, R = 0, ans = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    x[a[i]]++;
    R = max(R, x[a[i]]);
  }
  while (L <= R) {
    int M = (L + R) / 2;
    if (check(M)) {
      ans = M;
      L = M + 1;
    } else {
      R = M - 1;
    }
  }
  int sum = 0;
  for (int i = 1; i < 200005; i++) {
    int l = x[i] / ans;
    for (int j = 0; j < l; j++) {
      cout << i << " ";
      sum++;
      if (sum >= m) return 0;
    }
  }
  cout << endl;
  return 0;
}
