Problem J. Juxtaposition joke

Author:Антон Карабанов   Time limit:1 sec
Input file:Standard input   Memory limit:512 Mb
Output file:Standard output  

Statement

The blackboard in the math classroom had number n written on it. There were no zeros anywhere in the number. While passing along, Timofey decided to play a joke and swapped neighboring digits in the number k times. What is the largest possible resulting number?

Input format

Input contains integers n and k, one per line.

Output format

Output a single integer — problem answer.

Constraints

11 ≤ n ≤ 10250

k ≤ 109

Notes on samples

In the first sample n = 97 and a single swap, giving 79.

In the second sample it is optimal to move three to the first place and get 312

Sample tests

No. Standard input Standard output
1
97
1
79
2
123
2
312
3
5833917
9
9875331

0.071s 0.016s 13