#include <bits/stdc++.h>
using namespace std;
void so() {
  int n, k;
  cin >> n >> k;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int yy;
    cin >> yy;
    mp[yy]++;
  }
  int ans = 0;
  int l = 1, r = 200000;
  int mid;
  while (l <= r) {
    mid = (l + r) / 2;
    int tk = k;
    for (auto &xl : mp) {
      if (xl.second >= mid) {
        tk = tk - (xl.second / mid);
      }
    }
    if (tk <= 0) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  for (auto &xl : mp) {
    while (xl.second / ans && k) {
      k--;
      xl.second -= ans;
      cout << xl.first << " ";
    }
  }
  cout << endl;
}
int main() {
  so();
  return 0;
}
