/**
* author: Binoy Barman
* created: 2025-08-29 11:00:07
**/
#include<bits/stdc++.h>
using namespace std;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
string s;
cin >> s;
vector<int> f(26, 0);
int i = 0, j = 0;
while(i < n) {
int r = i + k - 1;
if(r >= n) break; // not enough length for a k-window
if(r == n - 1) {
sort(s.begin() + i, s.begin() + r + 1);
break;
}
// build frequency for substring [i .. r]
while(j < r) {
f[s[j] - 'a']++;
j++;
}
f[s[j] - 'a']++;
// check if there exists a smaller character than s[i]
int cur = s[i] - 'a';
bool exists = false;
for (int id = 0; id < cur; id++) {
exists |= (f[id] > 0);
}
if(exists) {
// sorting this window is optimal
sort(s.begin() + i, s.begin() + r + 1);
while(i <= r) {
f[s[i] - 'a']--;
i++;
}
}
else {
f[cur]--;
i++;
}
}
cout << s << '\n';
return 0;
}