#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    int val;
    scanf("%d", &val);
    mp[val]++;
  }
  int l = 1, r = n / k;
  vector<int> res;
  while (l <= r) {
    int m = (l + r) / 2;
    vector<int> temp;
    for (map<int, int>::iterator it = mp.begin();
         it != mp.end() && (int)temp.size() < k; it++) {
      int canTake = (it->second) / m;
      for (int j = 0; j < canTake && (int)temp.size() < k; j++)
        temp.push_back(it->first);
    }
    if ((int)temp.size() == k) {
      res = temp;
      l = m + 1;
    } else
      r = m - 1;
  }
  for (int i = 0; i < res.size(); i++) {
    if (i) printf(" ");
    printf("%d", res[i]);
  }
  puts("");
  return 0;
}
