#include <bits/stdc++.h>
using namespace std;
struct node
{
int l, r, value;
}a[255];
int main()
{
string s;
int k;
cin >> s >> k;
int len = s.size();
if(len <= k)
{
cout << 0;
return 0;
}
for(int i = 0; i < len; i ++)
a[i + 1].l = i, a[i + 1].r = i + 2, a[i + 1].value = (int)(s[i] - '0');
for(int j = 1; j <= k; j ++)
for(int i = 1; i <= len; i ++)
{
if(a[i].l == a[i].r) continue;
if(a[i].value > a[a[i].r].value)
{
a[a[i].r].l = a[i].l;
a[i].l = 0;
a[a[i].l].r = a[i].r;
a[i].r = 0;
break;
}
}
int cnt = 1;
while(a[cnt].l == a[cnt].r) cnt ++;
while(true)
{
cout << a[cnt].value;
cnt = a[cnt].r;
if(a[a[cnt].r].r == 0) break;
}
return 0;
}