数组 = list(map(int,input())) k = int(input()) a = [] while k > 0 and max(数组) != min(数组) and k != len(数组): j = 数组.index(max(数组)) if j > k: j = 数组.index(max(数组[:k+1])) a.append(数组[j]) 数组 = 数组[j+1:] k -= j a.extend(数组[k:]) print(''.join(list(map(str,a))))