LogiQuest

259. Count Subsets with Sum

MediumKnapsackCounting

Count the subsets of the positive numbers whose sum is exactly s (subsets at different positions are different). Print modulo 10⁹ + 7.

Input format

Line 1: n s Line 2: n positive integers

Output format

The count mod 10⁹ + 7.

Example 1

Input

6 10
2 3 5 6 8 10

Output

3

Example 2

Input

5 3
1 1 1 1 1

Output

10

Constraints

1 ≤ n ≤ 100 1 ≤ s ≤ 10⁴

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…