#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
struct node {
  int x, num;
} b[200005];
bool cmp(node x, node y) { return x.num > y.num; }
int n, m, cnt = 0, a[200005], c[200005], cc = 0, d[200005], dd = 0;
int ans;
bool solve(int x) {
  int y = 0;
  for (int i = 0; i < cc; i++) {
    y += b[i].num / x;
    if (y >= m) return false;
  }
  ans = x - 1;
  return true;
}
int main() {
  map<int, int> mp;
  memset(b, 0, sizeof(b));
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    mp[a[i]]++;
    if (mp[a[i]] == 1) c[cc++] = a[i];
  }
  for (int i = 0; i < cc; i++) {
    b[i].x = c[i];
    b[i].num = mp[c[i]];
  }
  sort(b, b + cc, cmp);
  for (int i = 1;; i++) {
    if (solve(i)) break;
  }
  for (int i = 0; i < cc; i++) {
    for (int j = 0; j < b[i].num / ans; j++) {
      d[dd++] = b[i].x;
    }
  }
  for (int i = 0; i < m; i++) {
    printf("%d ", d[i]);
  }
  cout << endl;
  return 0;
}
