program sl;
var
s:array[1..5000000]of char;
q,h:array[0..5000000]of longint;
n,l,i,j,k:longint;
begin
assign(input,'gamec.in');
assign(output,'gamec.out');
reset(input);
rewrite(output);
repeat
read(s[1]);
until s[1]>'0';
l:=1;
while not eoln do
begin inc(l); read(s[l]); q[l]:=l-1; h[l-1]:=l; end;
read(n); k:=l-n;
if k=0 then begin writeln(0); close(input);close(output); exit; end;
h[0]:=1;
j:=0;
repeat
j:=h[j];
i:=h[j];
while (i>0)and(n>0)and(s[i]<s[j]) do
begin
q[i]:=q[j];
h[q[j]]:=h[j];
j:=h[j];
dec(n);
if (q[j]>0) then j:=q[j];
i:=h[j];
end;
until (n=0)or(i=0);
i:=0;
j:=1;
while (j<=k)and(s[h[i]]='0') do
begin i:=h[i]; inc(j); end;
while j<=k do
begin
i:=h[i];
write(s[i]);
inc(j);
end;
close(input);
close(output);
end.