#include <bits/stdc++.h>
using namespace std;
const long long llinf = 2e18 + 7;
const int inf = 2e9 + 7;
const long long mod = 1e9 + 7;
const long long N = 1e6 + 7;
const long double pi = 3.14159265358979;
vector<pair<int, int> > v;
bool check(int mid, int k) {
  int cnt = 0;
  for (auto itr : v) {
    cnt += (itr.first / mid);
  }
  if (cnt >= k) return 1;
  return 0;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  map<int, int> mp;
  for (int i = 0; i < n; i++) mp[arr[i]]++;
  for (auto itr : mp) v.push_back({itr.second, itr.first});
  int lb = 1, ub = N, maxx = 0;
  while (lb <= ub) {
    int mid = (lb + ub) / 2;
    if (check(mid, k)) {
      maxx = mid;
      lb = mid + 1;
    } else {
      ub = mid - 1;
    }
  }
  vector<int> ans;
  for (auto itr : v) {
    int cnt = itr.first / maxx;
    while (cnt--) {
      ans.push_back(itr.second);
    }
    if (ans.size() >= k) break;
  }
  for (int i = 0; i < k; i++) cout << ans[i] << " ";
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
