#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int n, k;
bool canBe(long long d) {
  int ans = 0;
  for (auto it : mp) {
    ans += (it.second) / d;
  }
  if (ans >= k) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  int v;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    cin >> v;
    vec.push_back(v);
    mp[v]++;
  }
  long long low = 1, high = n;
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (canBe(mid)) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  long long d = low - 1;
  vector<int> ans;
  for (auto it : mp) {
    int sz = it.second / d;
    for (int i = 0; i < sz && k > 0; i++, k--) {
      ans.push_back(it.first);
    }
  }
  for (auto it : ans) cout << it << " ";
  cout << '\n';
  return 0;
}
