def main():
Str = input()
k = int(input())
res = ['0']
if k >= len(Str):
print('0')
return
# 遍历Str
for val in Str:
while k and res[-1] > val:
res.pop()
k -= 1
res.append(val)
# 完全排序后, k 还没用完
if k:
res = res[: len(res) - k]
# 去前面的0
for i in range(len(res)):
if res[i] != '0':
res = ''.join(res[i:])
break
print(res)
main()