#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k, ans, count = 0;
  cin >> n >> k;
  int a[n];
  map<int, int> m, m1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  for (auto i : m)
    for (int j = 1; j < i.second + 1; j++) m1[j] += i.second / j;
  for (auto i : m1) {
    if (i.second >= k) ans = i.first;
  }
  for (auto i : m)
    if (i.second >= ans) {
      for (int j = 1; j < (i.second / ans) + 1; j++) {
        if (count >= k) return 0;
        count++;
        cout << i.first << ' ';
      }
    }
  return 0;
}
