#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 7;
long long n, k, a[M];
bool check(long long mid, map<long long, long long> mp) {
  long long c = 0;
  for (long long i = 0; i < n; i++) {
    if (mp[a[i]] >= mid) {
      mp[a[i]] -= mid;
      c++;
    }
  }
  return c >= k;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k;
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  long long lo = 1, hi = n;
  long long ans = 1;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (check(mid, mp)) {
      ans = max(ans, mid);
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (mp[a[i]] >= ans) {
      mp[a[i]] -= ans;
      cout << a[i] << " ";
      k--;
    }
    if (k == 0) break;
  }
  return 0;
}
