#include <bits/stdc++.h>
using namespace std;
bool check(vector<pair<int, int>> &a, int copies, int k) {
  int cnt = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i].first < copies) {
      break;
    }
    cnt += a[i].first / copies;
    if (cnt >= k) {
      break;
    }
  }
  return cnt >= k;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  map<int, int> freq;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    freq[num]++;
  }
  vector<pair<int, int>> a(freq.size());
  int index = 0;
  for (auto i : freq) {
    a[index] = {i.second, i.first};
    index++;
  }
  sort(a.begin(), a.end(), greater<pair<int, int>>());
  int l = 1, r = a[0].first, ans = 0;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (check(a, mid, k)) {
      ans = mid;
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  int cnt = 0;
  if (ans == 0) {
    for (int i = 0; i < a.size() && cnt < k; i++) {
      for (int j = 0; j < a[i].first && cnt < k; j++) {
        cout << a[i].second << ' ';
        cnt++;
      }
    }
  } else {
    for (int i = 0; i < a.size() && cnt < k; i++) {
      int times = a[i].first / ans;
      for (int j = 0; j < times && cnt < k; j++) {
        cout << a[i].second << ' ';
        cnt++;
      }
    }
  }
  return 0;
}
