Bermutation

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

Your are given a permutation pp of integers from 11 to nn. You are allowed to modify this permutation in the following way: choose a segment of 2b2 b consecutive elements and swap the halves of this segment. Formally, if you choose the segment a_i,a_i+1,a_i+2b1a\_{i}, a\_{i + 1} \ldots, a\_{i + 2 b - 1}, you will get a_i+b,a_i+b+1,,a_i+2b1,a_i,a_i+1,,a_i+b1a\_{i + b}, a\_{i + b + 1}, \ldots, a\_{i + 2 b - 1}, a\_{i}, a\_{i + 1}, \ldots, a\_{i + b - 1} after swapping its halves.

Consider the set SS of all permutations which can be obtained from the given permutation pp by applying this modification zero or more times. The segment of 2b2 b consecutive elements for each modification can be chosen independently of the segments chosen for other modifications. List all these permutations in lexicographical order and enumerate them starting from 11. Your task is to find the number of pp itself in this ordered list. Print the answer modulo 120,586,241120\\,586\\,241.

입력

The first line of input contains one positive integer TT, the number of test cases. The test cases follow.

Each test case is given on two lines. The first line contains with two integers nn and bb (2n1052 \le n \le 10^5, 1b1 \le b and 2bn2 b \le n). The second line of each test case contains nn integers: the permutation pp. Each integer from 11 to nn appears on this line exactly once.

The sum of all nn in the input does not exceed 10510^5.

출력

Print the 11-based number of permutation pp in the lexicographically ordered list of all permutations which can be obtained by the described modifications, modulo 120,586,241120\\,586\\,241.