Sorting Game#2384

Sorting Game

1 second
128 megabytes
Very easy

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.

Input

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 .

Output

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.

Examples

Example 1

Loading
Loading