#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = LLONG_MAX;
const long long NINF = LLONG_MIN;
vector<pair<long long, long long> > v;
bool solve(long long val, long long k) {
  long long c = 0;
  for (auto x : v) c += (x.first) / val;
  if (c >= k)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t-- > 0) {
    long long n, k;
    cin >> n >> k;
    map<long long, long long> make_pair;
    long long x;
    for (long long i = 0; i < n; i++) {
      cin >> x;
      make_pair[x]++;
    }
    for (auto p : make_pair) {
      v.push_back({p.second, p.first});
    }
    sort(v.begin(), v.end(), greater<pair<long long, long long> >());
    long long l = 0, r = 2e5 + 2, mid;
    while (l + 1 != r) {
      mid = (l + r) / 2;
      if (solve(mid, k))
        l = mid;
      else
        r = mid;
    }
    long long val = l;
    if (solve(r, k)) val = r;
    long long cnt = 0;
    bool f = false;
    vector<long long> t;
    for (auto x : v) {
      for (long long i = 0; i < x.first / val; i++) {
        t.push_back(x.second);
        cnt++;
        if (cnt == k) {
          f = true;
          break;
        }
      }
      if (f) break;
    }
    for (auto it : t) cout << it << ' ';
  }
}
