#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[205000], cnt[205000];
int check(int x) {
  int cur = 0;
  for (int i = 1; i <= 200000; i++) cur += (cnt[i] / x);
  return cur >= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int lb = 1, rb = n / k, mid, ans = 1;
  while (lb <= rb) {
    mid = (lb + rb) >> 1;
    if (check(mid)) {
      ans = mid;
      lb = mid + 1;
    } else
      rb = mid - 1;
  }
  for (int i = 1; i <= 200000; i++) {
    if (cnt[i] >= ans) {
      int d = cnt[i] / ans;
      for (int j = 1; j <= d && k >= 1; j++) {
        cout << i << " ";
        k--;
      }
    }
    if (k == 0) return 0;
  }
  return 0;
}
