#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll loops")
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int INF = 1e18;
vector<long long int> ans;
long long int mod(long long int n) { return (n % MOD + MOD) % MOD; }
long long int fp(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int t = fp(a, b / 2);
  if (b % 2 == 0)
    return mod(t * t);
  else
    return mod(mod(t * t) * a);
}
long long int check(long long int mid,
                    vector<pair<long long int, long long int>> v,
                    long long int k) {
  long long int i = 0;
  long long int sum = 0;
  long long int count = 0;
  for (long long int i = 0; i < v.size(); i++) {
    if (v[i].first / mid < 0) break;
    sum += v[i].first / mid;
    if (sum >= k) {
      count = 1;
      break;
    }
  }
  if (count > 0) {
    ans.clear();
    long long int sum = 0;
    long long int z = 0;
    long long int n = v.size();
    for (long long int i = 0; i < n; i++) {
      sum = v[i].first / mid;
      if (sum + z > k) sum = k - z;
      for (long long int j = 0; j < sum; j++) ans.push_back(v[i].second);
      z += sum;
      if (z >= k) break;
    }
    return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    m[temp]++;
  }
  multimap<long long int, long long int> c;
  for (auto it = m.begin(); it != m.end(); it++) {
    c.insert({it->second, it->first});
  }
  vector<pair<long long int, long long int>> v;
  for (auto it = c.rbegin(); it != c.rend(); it++) {
    v.push_back({it->first, it->second});
  }
  long long int low = 1;
  long long int high = 200000;
  long long int mid;
  while (low <= high) {
    mid = (low + high) / 2;
    if (check(mid, v, k)) {
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  for (long long int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
