#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 2e5 + 10;
int a[maxn];
vector<int> ans;
vector<int> v;
bool judge(int x) {
  v.clear();
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i && a[i] != a[i - 1]) {
      for (int j = 0; j < cnt / x; j++) {
        if (v.size() >= m) break;
        v.push_back(a[i - 1]);
      }
      cnt = 0;
    }
    cnt++;
  }
  for (int j = 0; j < cnt / x; j++) {
    if (v.size() >= m) break;
    v.push_back(a[n - 1]);
  }
  if (v.size() < m)
    return false;
  else
    return true;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  int L = 1, R = n;
  int mid;
  int pos;
  for (int i = 0; i < m; i++) ans.push_back(a[i]);
  while (L <= R) {
    mid = L + R >> 1;
    if (judge(mid)) {
      pos = mid;
      ans.clear();
      for (int i = 0; i < v.size(); i++) ans.push_back(v[i]);
      L = mid + 1;
    } else {
      R = mid - 1;
    }
  }
  for (int i = 0; i < m; i++) {
    printf("%d%c", ans[i], i == m - 1 ? '\n' : ' ');
  }
  return 0;
}
