This page is still under construction.

Parts of this page are still being built. What you see may change.

Partition Number

Time limit3sMemory limit256 MB

Summary
Count partitions of m into nondecreasing positive parts, where a given set of n values is forbidden as a part, modulo 1e9+7.
Level

Hard8 of 10

Topics
Dynamic programming, Combinatorics, Math, Number theory
Solved
No attempts yet

Problem

You are given an integer set A={a1,a2,…,an}A=\{a_1,a_2,\ldots,a_n\}. Calculate the number of solutions to the equation x1+x2+…+xk=mx_1+x_2+\ldots+x_k=m, where the xix_i are positive integers, x1≤x2≤…≤xkx_1 \le x_2 \le \ldots \le x_k, and xi∉Ax_i \not \in A.

The answer can be very large, so calculate it modulo (109+7)(10^9 + 7).

Input

The input contains multiple test cases. The first line holds an integer TT, the number of test cases. Each test case is given as follows.

The first line contains two integers nn and mm (1≤n≤5001 \le n \le 500, n≤m≤3⋅105n \le m \le 3 \cdot 10^5).

The second line contains nn integers a1,a2,…,ana_1,a_2,\ldots,a_n (1≤ai≤m1 \le a_i \le m, and ai≠aja_i \ne a_j for all i≠ji \ne j).

The sum of nn over all test cases does not exceed 500500.

Output

For each test case, output one integer, the answer.

Hint

There are 55 solutions for m=4m=4 when the forbidden set AA is empty. They are: 4=1+1+1+1=1+1+2=1+3=2+2=4\begin{aligned} 4 & = & 1+1+1+1 \\ {} & = & 1+1+2 \\ {} & = & 1+3 \\ {} & = & 2+2 \\ {} & = & 4 \end{aligned}

Examples1

  1. Example 1

    Input
    5
    1 4
    1
    1 4
    2
    1 4
    3
    3 4
    1 2 3
    4 4
    1 2 3 4
    
    Expected output
    2
    3
    4
    1
    0