#include <bits/stdc++.h>
using namespace std;
const long long mx = 105;
const long long maxn = 1000001;
const long long mod = 1000000007;
vector<vector<int>> adj;
vector<int> res;
vector<int> ord;
vector<pair<long, long>> f1;
bool check(long long mid, long long k) {
  long long i, j, cur = 0;
  for (i = (int)f1.size() - 1; i >= 0; i--) {
    cur += f1[i].first / mid;
  }
  if (cur >= k) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1, n, m;
  while (t--) {
    long long n, k, i, j;
    cin >> n >> k;
    long long a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    vector<long long> freq(maxn);
    for (i = 0; i < n; i++) {
      freq[a[i]]++;
    }
    for (i = 1; i <= maxn; i++) {
      if (freq[i] > 0) {
        f1.push_back({freq[i], i});
      }
    }
    sort(f1.rbegin(), f1.rend());
    long long res = 0, l = 1, m, h = f1[0].first;
    while (l <= h) {
      m = l + (h - l) / 2;
      if (check(m, k)) {
        res = max(res, m);
        l = m + 1;
      } else {
        h = m - 1;
      }
    }
    long long cur = 0;
    for (i = (int)f1.size() - 1; i >= 0; i--) {
      long long te;
      if (cur >= k) {
        break;
      }
      if (cur + f1[i].first / res > k) {
        te = k - cur;
      } else {
        te = f1[i].first / res;
      }
      for (j = 0; j < te; j++) {
        cout << f1[i].second << " ";
      }
      cur += f1[i].first / res;
    }
  }
}
