#P2834. 纸币问题 3

纸币问题 3

Background

You are a very rich kid.

Note: This problem is the corresponding one in the “Advanced” section, but the input format is slightly different.

Problem Description

You have nn types of banknotes with distinct denominations. The denomination of the ii-th type is aia_i, and you have unlimited banknotes of each type. Now you need to pay an amount of ww. How many different combinations of banknotes can pay exactly ww? Output the answer modulo 109+710^9+7.

Input Format

The first line contains two positive integers n,wn, w, representing the number of types of banknotes and the amount to be formed.
The second line contains nn positive integers a1,a2,,ana_1, a_2, \dots, a_n separated by spaces, representing the denominations of the nn types of banknotes.

Output Format

Output one integer, representing the number of banknote combinations that can form exactly ww.

6 15
1 5 10 20 50 100
6
3 15
1 5 11
5

Hint

For 40%40\% of the testdata, n10n \le 10 and w100w \le 100.
For 100%100\% of the testdata, 1n1031 \le n \le 10^3 and 1ai,w1041 \le a_i, w \le 10^4.

In fact, the kid is not rich.

Translated by ChatGPT 5