#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, t;
  cin >> n >> t;
  map<int, int> m;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    v[i] = x;
    m[x]++;
  }
  int l = 1, r = n + 1;
  while (r - l > 1) {
    int mid = (r + l) / 2, kolvo = 0;
    for (auto el : m) kolvo += el.second / mid;
    if (kolvo < t)
      r = mid;
    else
      l = mid;
  }
  int a = 0;
  for (auto el : m) {
    if (a >= t) return 0;
    for (int i = 1; i <= el.second / l; ++i) {
      if (a < t) cout << el.first << " ";
      ++a;
    }
  }
  return 0;
}
