KK's Chemical

Accepts: 4
Submissions: 22
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
Problem Description
Our lovely KK has a difficult Chemical problem. There are $N\left(1\leq N\leq 100 \right)$ bottles of chemicals in the laboratory numbered from $0$ to $N-1$. KK was told to tidy up the laboratory. He needs to put them in K $\left(1\leq K\leq 1000 \right)$ different boxes. KK knows that it may cause explosion if the bottle numbered $i$ and the bottle numbered $c[i]$ been put in the same box. In order to survive, KK can not put any two bottles of chemicals that will cause the explosion in the same box. Now KK wants to know how many different ways are there that he can put the bottles in boxes safely. As the number may be huge, you should output the number mod ${10}^{9}+7$. It's guaranteed that $c[i] \neq i$.
Input
The first line of the input file contains an integer $T\left( 1\leq T\leq 200\right)$, which indicates the number of test cases. For each test case, there are two lines. The first line includes two integers $N\left(1\leq N\leq 100 \right)$ and $K\left(1\leq K\leq 1000 \right)$,indicating the number of the chemicals and the number of the boxes. The second line includes $N$ integers $c[i]\left( 0\leq c[i]\leq N-1\right)$.
Output
For each test case, there are one lines,includes a integer,indicating the answer mod ${10}^{9}+7$.
Sample Input
3
3 3
1 2 0
4 3
1 2 0 0
3 2
1 2 0
Sample Output
6
12
0