Intersection is Not Allowed!

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

문제

Consider a board of N×NN \times N squares. There are KNK \le N pieces on the board. The pieces are initially placed on some of the top squares of the board.

A piece located at square (r,c)(r, c) can move either one square to the right to (r,c+1)(r, c + 1) or one square down to (r+1,c)(r + 1, c).

Your task is to count how many different ways there are to move all pieces to the given positions at the bottom of the board, so that the paths of any two different pieces have no common squares. Two ways are considered different if there exists a piece which has different routes in these ways. As the number of ways can be rather large, find it modulo 109+710^{9} + 7.

입력

The first line of input contains an integer TT, the number of test cases (1T4001 \le T \le 400).

Each test case begins with a line containing two integers NN and KK representing the size of the chessboard and the number of pieces, respectively (1N1051 \le N \le 10^5, 1K1001 \le K \le 100).

The second line contains KK integers a_1a\_1, a_2a\_2, \ldots, a_Ka\_K representing the initial positions of the pieces (1a_1<a_2<<a_KN1 \le a\_1 < a\_2 < \ldots < a\_K \le N). Formally, the pieces are initially located at squares (1,a_1)(1, a\_1), (1,a_2)(1, a\_2), \ldots, (1,a_K)(1, a\_K).

The third line contains KK integers b_1b\_1, b_2b\_2, \ldots, b_Kb\_K representing the final positions of the pieces (1b_1<b_2<<b_KN1 \le b\_1 < b\_2 < \ldots < b\_K \le N). Formally, the pieces should be moved to (N,b_1)(N, b\_1), (N,b_2)(N, b\_2), \ldots, (N,b_K)(N, b\_K).

The sum of all NN in the input does not exceed 21072 \cdot 10^7.

The sum of all KK in the input does not exceed 21042 \cdot 10^4.

출력

Print TT lines, one for each test case. Each line must contain the number of different ways to move the pieces modulo 109+710^{9} + 7.