Partition Number
Time limit3sMemory limit256 MB
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 . Calculate the number of solutions to the equation , where the are positive integers, , and .
The answer can be very large, so calculate it modulo .
Input
The input contains multiple test cases. The first line holds an integer , the number of test cases. Each test case is given as follows.
The first line contains two integers and (, ).
The second line contains integers (, and for all ).
The sum of over all test cases does not exceed .
Output
For each test case, output one integer, the answer.
Hint
There are solutions for when the forbidden set is empty. They are: