#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
set<int> st;
vector<int> ve;
int ara[N], cnt[N], n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
    cnt[ara[i]]++;
    st.insert(ara[i]);
  }
  int hi = n, lo = 1, mid = 0, now = 0;
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    now = 0;
    for (int it : st) {
      now += cnt[it] / mid;
    }
    if (now >= k) {
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  lo--;
  for (int it : st) {
    int temp = cnt[it] / lo;
    int mn = min(temp, k);
    for (int i = 1; i <= mn; i++) {
      k--;
      ve.push_back(it);
    }
  }
  for (int it : ve) {
    cout << it << " ";
  }
  cout << "\n";
  return 0;
}
