#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int mod = 1e9 + 7;
const int B = sqrt(2e5);
int n, k;
int a[N];
int b[N];
int c[N];
int used[N];
vector<pair<int, pair<int, int> > > v;
bool can(int x) {
  for (int i = 1; i <= n; i++) used[a[i]] = 0;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (b[a[i]] >= x && !used[a[i]]) {
      used[a[i]] = b[a[i]] / x;
      cnt += used[a[i]];
    }
  }
  if (cnt >= k) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  int l = 0, r = n;
  while (l < r) {
    int m = (l + r) / 2;
    if (can(m + 1)) {
      l = m + 1;
    } else
      r = m;
  }
  can(l);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (used[a[i]] && cnt < k && !c[a[i]]) {
      for (int j = 1; j <= used[a[i]]; j++) {
        cout << a[i] << " ";
        cnt++;
        if (cnt == k) break;
      }
      c[a[i]] = 1;
    }
  }
}
