#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int k;
cin>>s>>k;
while(k--){
int i;
for(i=0;i<s.length();){
if(s[i]=='0') s.erase(i,1);
if(s[i]<s[i+1]) i++;
else break;
}
s.erase(i,1);
}
while(s[0]=='0'&&s.length()>1){
s.erase(0,1);
}
cout<<s;
return 0;
}