#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 types of banknotes with distinct denominations. The denomination of the -th type is , and you have unlimited banknotes of each type. Now you need to pay an amount of . How many different combinations of banknotes can pay exactly ? Output the answer modulo .
Input Format
The first line contains two positive integers , representing the number of types of banknotes and the amount to be formed.
The second line contains positive integers separated by spaces, representing the denominations of the types of banknotes.
Output Format
Output one integer, representing the number of banknote combinations that can form exactly .
6 15
1 5 10 20 50 100
6
3 15
1 5 11
5
Hint
For of the testdata, and .
For of the testdata, and .
In fact, the kid is not rich.
Translated by ChatGPT 5