#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  unordered_map<int, int> hash;
  struct comp {
    bool operator()(pair<int, int>& a, pair<int, int>& b) {
      return a.second < b.second;
    };
  };
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    hash[a[i]]++;
  }
  priority_queue<pair<int, int>, vector<pair<int, int>>, comp> pq;
  for (auto it = hash.begin(); it != hash.end(); ++it) {
    pq.push(make_pair(it->first, it->second));
  }
  a.clear();
  while (pq.size()) {
    a.push_back(pq.top().first);
    pq.pop();
  }
  int l = 1, r = n / k, m = r;
  int cnt = 0;
  for (int i = 0; i < a.size(); ++i) {
    cnt += hash[a[i]] / m;
  }
  if (cnt >= k) {
    l = r;
  }
  while (l < r) {
    m = l + (r - l + 1) / 2;
    cnt = 0;
    for (int i = 0; i < a.size(); ++i) {
      cnt += hash[a[i]] / m;
    }
    if (cnt >= k) {
      l = m;
    } else {
      r = m - 1;
    }
  }
  for (int i = 0; i < a.size(); ++i) {
    for (int j = 0; j < hash[a[i]] / l; ++j) {
      cout << a[i] << ' ';
      k--;
      if (!k) return 0;
    }
  }
  return 0;
}
