In The Sorting Game, you are given a sequence containing a permutation of the integers between and , inclusive. In one move, you can take any consecutive elements of the sequence and reverse their order. Find the fewest number of moves to sort the sequence in ascending order.
The input consists of multiple test cases. The first line of each test case contains two integers (2 \leq n \leq 8) and (2 \leq k \leq n). The second line of each test case contains a permutation of numbers from to .
For each test case, print in a separate line the fewest number of moves to sort the sequence in ascending order, or if it's impossible.
Example 1