/*
Coder: __turing__
Tran Van Nam - Chuyen Tin Nguyen Trai High School - Quang Binh
*/
#include <bits/stdc++.h>
using namespace std;
#define file(name) if (fopen(name".INP", "r")){freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout);}
int p = 0;
char Stack[10000007];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
file("TEST");
string s; int k;
cin >> s >> k;
for (int i = 0; i < (int)s.length(); i++)
if (p == 0) Stack[++p] = s[i];
else{
while (p > 0 && k > 0 && Stack[p] < s[i]) p--, k--;
Stack[++p] = s[i];
}
while (p > 0 && k > 0) p--, k--;
string ans = "";
for (int i = 1; i <= p; i++) ans += Stack[i];
p = 0;
while (p < (int)ans.length()-1 && ans[p] == '0') p++;
for (; p < (int)ans.length(); p++) cout << ans[p];
return 0^0;
}
LyoKCUNvZGVyOiBfX3R1cmluZ19fCglUcmFuIFZhbiBOYW0gLSBDaHV5ZW4gVGluIE5ndXllbiBUcmFpIEhpZ2ggU2Nob29sIC0gUXVhbmcgQmluaAoqLwojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgZmlsZShuYW1lKSBpZiAoZm9wZW4obmFtZSIuSU5QIiwgInIiKSl7ZnJlb3BlbihuYW1lIi5JTlAiLCAiciIsIHN0ZGluKTsgZnJlb3BlbihuYW1lIi5PVVQiLCAidyIsIHN0ZG91dCk7fQoKaW50IHAgPSAwOwpjaGFyIFN0YWNrWzEwMDAwMDA3XTsKCnNpZ25lZCBtYWluKCl7Cglpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwoJY2luLnRpZSgwKTsgY291dC50aWUoMCk7CgoJZmlsZSgiVEVTVCIpOwoJCglzdHJpbmcgczsgaW50IGs7CgljaW4gPj4gcyA+PiBrOwoJZm9yIChpbnQgaSA9IDA7IGkgPCAoaW50KXMubGVuZ3RoKCk7IGkrKykKCQlpZiAocCA9PSAwKSBTdGFja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