#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 5;
map<int, int> m;
int a[maxN], n, k;
bool check(int no) {
  int curr = 0;
  for (auto x : m) {
    curr += (x.second / no);
  }
  return curr >= k;
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  int low = 1, high = n, mid = 0, res = 0;
  while (low <= high) {
    mid = low + (high - low) / 2;
    if (check(mid)) {
      low = mid + 1;
      res = mid;
    } else {
      high = mid - 1;
    }
  }
  vector<int> v;
  for (auto x : m) {
    for (int i = 0; i < x.second / res; i++) {
      v.push_back(x.first);
    }
  }
  assert((int)v.size() >= k);
  for (int i = 0; i < k; i++) {
    cout << v[i] << " ";
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
