#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;
ll indx[n];
for (ll i = 0; i < n; i++) indx[i] = -1;
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});
if (st.size() == k) {
auto it = *st.begin();
if (it.first < s[i]) indx[i] = it.second;
}
}
for (ll i = 0; i < n; ) {
if (indx[i] == -1) {
cout << s[i];
i++;
continue;
}
string temp = s.substr(i, k);
sort(temp.begin(), temp.end());
cout << temp;
i += k;
}
}