#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 1;
int cnt[MAX];
int n, k, nu;
vector<int> result;
bool check(int n) {
  result.clear();
  for (int i = 0; i < MAX; i++) {
    int required = min(int(cnt[i] / n), k - int(result.size()));
    for (int j = 0; j < required; j++) {
      result.push_back(i);
    }
  }
  return (int(result.size()) == k);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &nu);
    cnt[nu]++;
  }
  int l, r, mid;
  l = 0;
  r = n;
  while (r - l > 1) {
    mid = (l + r) >> 1;
    if (check(mid)) {
      l = mid;
    } else {
      r = mid;
    }
  }
  if (!check(r)) {
    check(l);
  }
  for (auto x : result) {
    printf("%d ", x);
  }
  return 0;
}
