from itertools import combinations
b, c = map(int, input().split())
a = len(str(b))
lst = list(combinations(str(b), a - c))
lst = sorted(lst)
print(*lst[0], sep='')

c85e5e75559e8cfcd7eafd6d4f9c8773fc15aba9
<mask token>

<mask token>
print(*lst[0], sep='')

<mask token>
b, c = map(int, input().split())
a = len(str(b))
lst = list(combinations(str(b), a - c))
lst = sorted(lst)
print(*lst[0], sep='')

from itertools import combinations
b, c = map(int, input().split())
a = len(str(b))
lst = list(combinations(str(b), a - c))
lst = sorted(lst)
print(*lst[0], sep='')
