#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  std::map<long long, long long> m;
  for (int i = 0; i < n; ++i) {
    m[a[i]]++;
  }
  long long l = 1, r = n / k, mid;
  multiset<long long> ans, s;
  multiset<long long>::iterator it;
  map<long long, long long> m1;
  while (l <= r) {
    mid = l + (r - l) / 2;
    long long c = 0;
    m1 = m;
    s.clear();
    for (int i = 0; i < n; ++i) {
      if (m1[a[i]] >= mid) {
        s.insert(a[i]);
        c++;
        m1[a[i]] -= mid;
      }
      if (c == k) {
        break;
      }
    }
    if (c >= k) {
      ans = s;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  for (it = ans.begin(); it != ans.end(); it++) {
    cout << *it << " ";
  }
  cout << endl;
  return 0;
}
