#include <bits/stdc++.h>
using namespace std;
int i, i0, n, m, cnt[200005], k;
struct node {
  int i, v;
} a[200005];
bool cmp(node a, node b) {
  if (a.v == b.v) return a.i > b.i;
  return a.v > b.v;
}
vector<int> ans;
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    while (n--) {
      int tmp;
      scanf("%d", &tmp);
      cnt[tmp]++;
    }
    for (i = 1; i <= 200000; i++) {
      a[i].i = i, a[i].v = cnt[i];
    }
    sort(a + 1, a + 1 + 200000, cmp);
    int l = 0, r = 200000;
    while (l < r) {
      int mid = (l + r + 1) / 2;
      int cnt = k;
      for (i = 1; i <= 200000; i++) {
        if (cnt <= 0) break;
        cnt -= a[i].v / mid;
      }
      if (cnt <= 0) {
        l = mid;
      } else
        r = mid - 1;
    }
    for (i = 1; i <= 200000; i++) {
      int cnt = a[i].v / r;
      while (cnt--) {
        ans.push_back(a[i].i);
        if (ans.size() == k) goto aa;
      }
    }
  aa:
    for (i = 0; i < ans.size(); i++) {
      printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
    }
  }
  return 0;
}
