#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
ll n, k; cin >> n >> k;
string s; cin >> s;
if (n == k) {
sort(s.begin(), s.end());
cout << s << "\n";
return 0;
}
ll indx[n];
for (ll i = 0; i < n; i++) indx[i] = i;
ll j = n-1;
set<pair<char, ll>> st;
for (ll i = n-1; i >= 0; i--) {
if (st.size() >= k) {
st.erase({s[j], j});
j--;
}
st.insert({s[i], i});
auto it = *st.begin();
if (it.first < s[i]) indx[i] = it.second;
}
ll ache = 0;
for (ll i = 0; i < n; ) {
if (indx[i] == i) {
cout << s[i];
ache++;
i++;
continue;
}
if (i+k >= n) {
if (ache + (n-i) >= k) {
string temp = s.substr(i);
sort(temp.begin(), temp.end());
cout << temp;
}
else cout << s.substr(i);
break;
}
string temp = s.substr(i, k);
sort(temp.begin(), temp.end());
cout << temp;
i += k;
ache = 0;
}
}