rt,84,WA * 1
#include<bits/stdc++.h>
using namespace std;
stack<char>num;
int main()
{
string st;int k;cin>>st>>k;
for(int i=0;i<st.length();++i)
{
if(!k or num.empty())
{
num.push(st[i]);
continue;
}
if(st[i]<num.top())
while(st[i]<num.top())
{
--k;num.pop();
if(num.empty())break;
}
if(num.empty())
num.push(st[i]);
else if(st[i]>=num.top())
num.push(st[i]);
}
while(k-- and num.size())num.pop();
stack<char>st2;while(num.size())
{st2.push(num.top());num.pop();}
while(st2.size())
{
if(st2.top()^48)break;
else st2.pop();
}if(st2.empty())puts("0");
while(st2.size())
{cout<<st2.top();st2.pop();}
}