#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k, d[N], dem, xx, luu[N];
map<int, int> m;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> xx;
    if (!m[xx]) {
      m[xx] = ++dem;
      luu[dem] = xx;
    }
    ++d[m[xx]];
  }
  int u = 0, v = n, mid;
  while (v - u > 1) {
    mid = (u + v) / 2;
    int kk = 0;
    for (int i = 1; i <= dem; ++i) kk += d[i] / mid;
    if (kk >= k)
      u = mid;
    else
      v = mid;
  }
  for (int i = 1; i <= dem; ++i) {
    while (k && d[i] >= u) {
      --k;
      d[i] -= u;
      cout << luu[i] << " ";
    }
    if (k == 0) break;
  }
  return 0;
}
