#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9 + 7;
const long long int modc = 998244353;
long long int A[200005];
long long int check(long long int x, long long int n, long long int k,
                    long long int t) {
  map<long long int, long long int> cnt;
  for (long long int i = 0; i < n; i++) cnt[A[i]] += 1;
  long long int i = 0;
  vector<long long int> Ans;
  while (i < n && k > 0) {
    if (cnt[A[i]] >= x) Ans.push_back(A[i]), k -= 1, cnt[A[i]] -= x;
    i += 1;
  }
  if (t == 1) {
    for (auto x : Ans) cout << x << " ";
  }
  if (k == 0) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> A[i];
  long long int l = 0, h = n;
  long long int ans = 0;
  while (l < h) {
    long long int mid = (l + h + 1) / 2;
    if (check(mid, n, k, 0)) {
      l = mid;
      ans = mid;
    } else
      h = mid - 1;
  }
  long long int a = check(ans, n, k, 1);
  return 0;
}
