#include <bits/stdc++.h>
using namespace std;
struct node {
  int num;
  int t;
} s[200005];
int len = 0, max2 = 0, max1 = 0, n, k;
vector<int> res;
bool cmp(node x, node y) { return x.num > y.num; }
bool check(int x) {
  int ans = 0;
  for (int i = 0; i < len; i++) {
    if (s[i].num < x) break;
    int xx = s[i].num / x;
    ans += xx;
    if (ans >= k) return true;
  }
  return false;
}
int num[200005];
int a[200005];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    num[a[i]]++;
    max1 = max(max1, a[i]);
  }
  if (n == k) {
    for (int i = 0; i < n; i++) {
      if (i != 0) printf(" ");
      printf("%d", a[i]);
    }
    printf("\n");
    return 0;
  }
  for (int i = 0; i <= max1; i++) {
    if (num[i] > 0) {
      s[len].num = num[i];
      s[len++].t = i;
      max2 = max(max2, num[i]);
    }
  }
  sort(s, s + len, cmp);
  int l = 1, r = max2, m;
  while (l < r) {
    m = l + r + 1 >> 1;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  int ans = 0;
  for (int i = 0; i < len; i++) {
    int xx = s[i].num / l;
    ans += xx;
    if (ans >= k) {
      for (int j = ans - xx + 1; j <= k; j++) res.push_back(s[i].t);
      break;
    } else {
      for (int j = 1; j <= xx; j++) res.push_back(s[i].t);
    }
  }
  for (int i = 0; i < res.size(); i++) {
    if (i != 0) printf(" ");
    printf("%d", res[i]);
  }
  printf("\n");
  return 0;
}
