A Binary Search Tree (BST) is a rooted binary tree with the following properties:
The left subtree contains only nodes with values strictly less than the value at the root.
The right subtree contains only nodes with values strictly greater than the value at the root.
All node values are distinct.
The left and right subtrees are also recursively binary search trees.
When inserting a new node, the following algorithm is used:
If the tree is empty, the new node becomes the root and the insertion process ends. Otherwise, proceed to step .
Set the root of the tree as the current node.
If the value of the new node is less than the current node:
If the left subtree of the current node is empty, the new node becomes the left child of the current node and the algorithm ends.
Otherwise, set the current node to the root of the left subtree and return to step .
If the value of the new node is greater than the current node:
If the right subtree of the current node is empty, the new node becomes the right child of the current node and the algorithm ends.
Otherwise, set the current node to the root of the right subtree and return to step .
The BST structure depends on the input sequence. Different sequences may produce different structures, even if the numbers themselves are the same.
Consider the sequence . We obtain the following BST:

If the input sequence is , we obtain the tree:

On the other hand, different inputs can yield the same BST structure. For example, the sequence will create the same BST structure as the sequence . The tree will be:

Given nodes of a BST, determine how many different input sequences produce the same BST structure as the given one. The node values are taken from the range .
The first line contains the number of tests (t \leq 100). Each test starts with two integers and (1 \leq n \leq m \leq 1000) — the number of nodes in the BST and the maximum value of the range, respectively. The next line contains integers a_i (1 \leq a_i \leq 1000) — the sequence by which the BST is built.
For each test, print the number of different sequences that produce the same BST structure, assuming values are taken from the range . Output the result modulo .
Note: Explanation for the second test.
There are input sequences (with values chosen from the interval ) that form the same BST structure:
Example 1