#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const long long INF = 1e12;   const int MOD = 1e9 + 7;   const unsigned long long BIT_FLAG_0 = (1 << 0);   const unsigned long long BIT_FLAG_1 = (1 << 1);   const unsigned long long BIT_FLAG_2 = (1 << 2);   const unsigned long long BIT_FLAG_3 = (1 << 3);   const unsigned long long BIT_FLAG_4 = (1 << 4);   const unsigned long long BIT_FLAG_5 = (1 << 5);   const unsigned long long BIT_FLAG_6 = (1 << 6);   const unsigned long long BIT_FLAG_7 = (1 << 7);   const long long dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};   const long long Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},                   Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};   void print() { cout <<   n ; }   template <class Head, class... Tail>   void print(Head &&head, Tail &&...tail) {     cout << head;     if (sizeof...(tail) != 0) cout <<    ;     print(forward<Tail>(tail)...);   }   template <class T>   void print(vector<T> &vec) {     for (auto &a : vec) {       cout << a;       if (&a != &vec.back()) cout <<    ;     }     cout <<   n ;   }   template <class T>   void print(set<T> &set) {     for (auto &a : set) {       cout << a <<    ;     }     cout <<   n ;   }   template <class T>   void print(vector<vector<T>> &df) {     for (auto &vec : df) {       print(vec);     }   }   long long power(long long a, long long n) {     long long res = 1;     while (n > 0) {       if (n & 1) res = res * a;       a *= a;       n >>= 1;     }     return res;   }   long long comb(long long n, long long k) {     vector<vector<long long>> v(n + 1, vector<long long>(n + 1, 0));     for (long long i = 0; i < (long long)((v).size()); i++) {       v[i][0] = 1;       v[i][i] = 1;     }     for (long long k = 1; k < (long long)((v).size()); k++) {       for (long long j = 1; j < k; j++) {         v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);       }     }     return v[n][k];   }   void add(long long &a, long long b) {     a += b;     if (a >= MOD) a -= MOD;   }   template <class T>   inline bool chmin(T &a, T b) {     if (a > b) {       a = b;       return true;     }     return false;   }   template <class T>   inline bool chmax(T &a, T b) {     if (a < b) {       a = b;       return true;     }     return false;   }   __attribute__((constructor)) void faster_io() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);   }   long long n, k;   map<long long, long long> got;   pair<bool, multiset<long long>> isOK(long long idx) {     multiset<long long> ans;     multiset<long long> trueans;     long long cnt = 0;     for (const auto &[key, value] : got) {       long long types = value / idx;       cnt += types;       for (long long ti = 0; ti < (long long)(types); ti++) {         ans.insert(key);       }     }     if (cnt >= k) {       long long now = 0;       for (auto i : ans) {         trueans.insert(i);         now++;         if (now == k) {           break;         }       }       return make_pair(true, trueans);     } else {       return make_pair(false, trueans);     }   }   multiset<long long> bin_search() {     multiset<long long> finalans;     long long ng = n + 1;     long long ok = 0;     while (abs(ok - ng) > 1) {       long long mid = (ok + ng) / 2;       long long bl = isOK(mid).first;       auto nums = isOK(mid).second;       if (bl) {         ok = mid;         finalans = nums;       } else         ng = mid;     }     return finalans;   }   signed main() {     cin >> n >> k;     vector<long long> A(n);     for (long long ni = 0; ni < (long long)(n); ni++) {       long long v;       cin >> v;       A[ni] = v;       got[v]++;     }     auto ret = bin_search();     for (auto i : ret) {       cout << i <<    ;     }     return 0;   }   