One day, Tanya was studying graph theory. She is very inquisitive, so the following problem soon came to her mind.
Find the number of undirected unweighted connected simple graphs with $N$ vertices (numbered $1$ through $N$) and $M$ edges, such that for each $i$ ($2 \le i \le N$), the shortest path from vertex $1$ to vertex $i$ is unique and its length is equal to $A_i$. In other words, for each $i$ ($2 \le i \le N$), there should be exactly one path with length $A_i$ between vertices $1$ and $i$, and there should be no paths with smaller length between these vertices.
Two graphs with $N$ vertices are distinct if we can find two vertices $u$ and $v$ such that there is an edge between these vertices in one graph, but not in the other graph.
Since the answer could be very large, compute it modulo $1,000,000,007$ ($10^9 + 7$).

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains two space-separated integers $N$ and $M$.
- The second line contains $N - 1$ space-separated integers $A_2, A_3, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing one integer ― the number of graphs modulo $10^9 + 7$.

-----Constraints-----
- $1 \le T \le 1,000$
- $2 \le N \le 10^5$
- $N-1 \le M \le \mathrm{min}\left(2\cdot 10^5, \frac{N(N-1)}{2}\right)$
- $1 \le A_i \le N-1$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $2 \cdot 10^5$
- the sum of $M$ over all test cases does not exceed $2 \cdot 10^5$

-----Subtasks-----
Subtask #1 (50 points): $M = N-1$
Subtask #2 (50 points): original constraints

-----Example Input-----
3
4 3
1 2 1
4 6
1 2 1
3 2
2 2

-----Example Output-----
2
0
0

-----Explanation-----
Example case 1: The two graphs which satisfy all conditions are:

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import sys\nimport math\nfrom collections import defaultdict,Counter\n\n# input=sys.stdin.readline\n# def print(x):\n#     sys.stdout.write(str(x)+"\\n")\n\n# sys.stdout=open("CP3/output.txt",\'w\')\n# sys.stdin=open("CP3/input.txt",\'r\')\n\nm=pow(10,9)+7\nt=int(input())\nfor i in range(t):\n n,m1=map(int,input().split())\n a=list(map(int,input().split()))\n if m1==n-1:\n  ans=1\n  c=Counter(a)\n  for j in c:\n   if j==1:\n    continue\n   ans=(ans*pow(c.get(j-1,0),c[j],m))%m\n  #   if c[j]>c.get(j-1,0):\n  #       ans=0\n  #       break\n  #   cur=1\n  #   for k in range(c[j-1],c[j-1]-c[j],-1):\n  #       cur=(cur*k)%m\n  #   ans=(ans+cur)%m\n  # if max(c)==1:\n  #   ans=1\n  print(ans)\n else:\n  print(0)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13827