#include <bits/stdc++.h>
using ll = long long;
const int N = 2e5 + 5;
bool isPossible(int val, int k, std::vector<std::pair<int, int>> &occur) {
  for (int i = 0; i < (int)occur.size(); ++i) {
    for (int len = std::min(occur[i].first, k); len >= 1; --len) {
      if (len * val <= occur[i].first) {
        k -= len;
        break;
      }
    }
    if (k == 0) {
      return true;
    }
  }
  return false;
}
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  int n, k;
  std::cin >> n >> k;
  std::vector<int> freq(N, 0);
  for (int i = 0; i < n; ++i) {
    int x;
    std::cin >> x;
    ++freq[x];
  }
  std::vector<std::pair<int, int>> occur;
  for (int i = 1; i < N; ++i) {
    if (freq[i] == 0) {
      continue;
    }
    occur.push_back({freq[i], i});
  }
  std::sort(occur.begin(), occur.end(), std::greater<std::pair<int, int>>());
  int left = 1, right = n;
  int ans = -1;
  while (left <= right) {
    int mid = left + (right - left + 1) / 2;
    if (isPossible(mid, k, occur)) {
      left = mid + 1;
      ans = mid;
    } else {
      right = mid - 1;
    }
  }
  std::vector<int> res;
  for (int i = 0; i < (int)occur.size(); ++i) {
    for (int len = std::min(occur[i].first, k); len >= 1; --len) {
      if (len * ans <= occur[i].first) {
        k -= len;
        for (int j = 0; j < len; ++j) {
          res.push_back(occur[i].second);
        }
        break;
      }
    }
    if (k == 0) {
      break;
    }
  }
  for (int i = 0; i < (int)res.size(); ++i) {
    std::cout << res[i] << " ";
  }
  std::cout << "\n";
}
