#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long fx[] = {+1, -1, +0, +0};
const long long fy[] = {+0, +0, +1, -1};
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
vector<pair<long long, long long> > a;
bool isvalid(long long mid, long long k) {
  long long cnt = 0;
  for (long long i = 0; i < a.size(); i++) {
    cnt += a[i].second / mid;
  }
  if (cnt >= k) {
    return true;
  } else {
    return false;
  }
}
void solve() {
  long long n, k;
  cin >> n >> k;
  unordered_map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    m[x]++;
  }
  for (auto v : m) {
    a.push_back({v.first, v.second});
  }
  long long lo = 1, hi = n, mid;
  while (lo < hi) {
    mid = lo + (hi - lo + 1) / 2;
    if (isvalid(mid, k)) {
      lo = mid;
    } else {
      hi = mid - 1;
    }
  }
  vector<long long> ans;
  for (long long i = 0; i < a.size() && ans.size() < k; i++) {
    long long x = a[i].second / lo;
    while (x > 0 && ans.size() < k) {
      ans.push_back(a[i].first);
      x--;
    }
  }
  for (auto& a : ans) cout << a << " ";
  cout << endl;
  ;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
