#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
map<int, int> mp;
int main() {
  int n, m, k;
  cin >> n >> m;
  int l = 1, r = n / m + 1;
  while (n--) {
    scanf("%d", &k);
    mp[k]++;
  }
  while (l + 1 < r) {
    int mid = l + r >> 1, sum = 0;
    for (auto i : mp) {
      sum += i.second / mid;
      if (sum >= m) {
        l = mid;
        break;
      }
    }
    if (sum < m) r = mid;
  }
  for (auto i : mp) {
    for (int j = 0; j < i.second / l; j++) {
      if (m--)
        printf("%d ", i.first);
      else
        return 0;
    }
  }
}
