#include <bits/stdc++.h>
using namespace std;
set<long long> s;
long long m[200200], a[200200], k;
bool check(long long x) {
  long long co = 0;
  for (auto u : s) {
    co += (m[u] / x);
  }
  if (co >= k) return 1;
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, i;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
    s.insert(a[i]);
  }
  long long S = 1, E = n, ans = 1;
  while (S <= E) {
    long long mid = (S + E) / 2;
    if (check(mid))
      ans = mid, S = mid + 1;
    else
      E = mid - 1;
  }
  long long co = k;
  for (auto x : s) {
    for (int j = 0; j < m[x] / ans && co > 0; j++) cout << x << " ", co--;
    if (co <= 0) break;
  }
  return 0;
}
