#include <bits/stdc++.h>
using namespace std;
struct arra {
  long long int d = 0, idx;
} arr[200008];
bool comp(struct arra a, struct arra b) { return a.d > b.d; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, a, temp, ans;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a;
    arr[a].d++;
    arr[a].idx = a;
  }
  sort(arr, arr + 200005, comp);
  long long int l = 1, r = 200008, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    temp = 0;
    for (int i = 0; i < n; i++) {
      temp += arr[i].d / mid;
    }
    if (temp >= k) {
      ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < arr[i].d / ans; j++) {
      v.push_back(arr[i].idx);
    }
  }
  for (int i = 0; i < k; i++) cout << v[i] << " ";
  return 0;
}
