/*
给你n和m,删除n中的m位数,
贪心...
*/
#include <stdio.h>
#include <string.h>
int main()
{
char s[1001];
int m,min,len,k,i,j,bg;
while(scanf("%s%d",&s,&m)==2)
{
i=0;
len = strlen(s);
while(m>0&&i+m<len)
{
min = s[i];
k = 0;
for(j=1;j<=m&&i+j<len;j++)
{
if(s[i+j]<min)
{
min = s[i+j];
k = j;
}
}
for(j=0;j<k;j++)
s[i+j] = '-';
m-=k;
i+=k+1;
}
for(;m>0&&i<len;i++)
s[i] = '-';
bg = 0;
for(i=0;i<len;i++)
{
if(s[i]=='-') continue;
if(s[i]!='0')
bg = 1;
if(bg||s[i]!='0')
putchar(s[i]);
}
if(!bg) putchar('0');
putchar(10);
}
}