#include <bits/stdc++.h>
using namespace std;
vector<long long int> c;
long long int k;
bool canCut(long long int t) {
  long long int count = 0;
  long long int size = c.size();
  for (long long int i = 0; i < size; i++) {
    count += c[i] / t;
    if (count >= k) return true;
  }
  return false;
}
long long int binSearch(long long int i, long long int j) {
  if (i >= j) return i;
  long long int t = (i + j + 1) / 2;
  if (canCut(t))
    return binSearch(t, j);
  else
    return binSearch(i, t - 1);
}
int main() {
  map<long long int, long long int> count;
  long long int n;
  cin >> n >> k;
  long long int x;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    if (count.find(x) == count.end())
      count[x] = 1;
    else
      count[x] += 1;
  }
  for (auto elem : count) c.push_back(elem.second);
  sort(c.begin(), c.end(), greater<long long int>());
  long long int t = binSearch(1, n / k);
  for (auto elem : count) {
    if (elem.second >= t) {
      long long int p = elem.second / t;
      for (long long int i = 0; i < p; i++) {
        cout << elem.first << " ";
        k--;
        if (!k) break;
      }
    }
    if (!k) break;
  }
}
