#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  map<int, int> m;
  for (int i = 0; i < n; i++) m[arr[i]]++;
  int d;
  for (int i = 1, j = n; j >= i;) {
    int m1 = (i + j) / 2;
    long long int s = 0;
    for (auto p = m.begin(); p != m.end(); p++) {
      s = s + (p->second) / m1;
    }
    if (s < k)
      j = m1 - 1;
    else {
      d = m1;
      i = m1 + 1;
    }
  }
  int f = 0;
  for (auto p = m.begin(); p != m.end(); p++) {
    int s = (p->second) / d;
    for (int i = 0; i < s; i++) {
      cout << p->first << " ";
      f++;
      if (f == k) break;
    }
    if (f == k) break;
  }
  return 0;
}
