#include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int cnt[N];   int n, k;   int cut[N];   vector<pair<int, int> > arr;   struct Sub {     bool operator()(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {       if (a.first != b.first)         return a.first < b.first;       else         return (cnt[a.second.second] / (a.second.first + 1)) <                (cnt[b.second.second] / (b.second.first + 1));     }   };   bool ForSort(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }   int main() {     scanf( %d%d , &n, &k);     int tx;     for (int i = 1; i <= n; i++) scanf( %d , &tx), cnt[tx]++;     for (int i = 1; i <= 200000; i++)       if (cnt[i] > 0) arr.push_back({cnt[i], i});     sort(arr.begin(), arr.end(), ForSort);     priority_queue<pair<int, pair<int, int> >,                    vector<pair<int, pair<int, int> > >, Sub>         pq;     int len = 1, ex = arr[0].first;     cut[arr[0].second] = 1;     cout << arr[0].second <<    ;     pq.push(pair<int, pair<int, int> >(arr[0].first,                                        pair<int, int>(1, arr[0].second)));     int i = 1;     pair<int, pair<int, int> > u =         pair<int, pair<int, int> >(2, pair<int, int>(10, 1));     pair<int, pair<int, int> > v =         pair<int, pair<int, int> >(2, pair<int, int>(4, 2));     while (len < k) {       pair<int, pair<int, int> > u = pq.top();       if (i >= arr.size()) {         if (cut[u.second.second] + 1 <= cnt[u.second.second]) {           len++;           cut[u.second.second] = u.second.first + 1;           pq.pop();           cout << u.second.second <<    ;           pq.push(pair<int, pair<int, int> >(               cnt[u.second.second] / (u.second.first + 1),               pair<int, int>(u.second.first + 1, u.second.second)));         } else           pq.pop();       } else {         if (u.second.first + 1 <= cnt[u.second.second] &&             cnt[u.second.second] / (u.second.first + 1) > arr[i].first) {           cut[u.second.second] = u.second.first + 1;           cout << u.second.second <<    ;           len++;           pq.pop();           pq.push(pair<int, pair<int, int> >(               cnt[u.second.second] / (u.second.first + 1),               pair<int, int>(u.second.first + 1, u.second.second)));         } else {           ex = min(ex, arr[i].first);           cut[arr[i].second] = 1;           cout << arr[i].second <<    ;           len++;           pq.push(pair<int, pair<int, int> >(arr[i].first,                                              pair<int, int>(1, arr[i].second)));           i++;         }       }     }     return 0;   }   