A cafeteria sells snack coupons in
Count how many different combinations of packs can make exactly
Print the answer modulo
The hidden idea: process pack sizes one by one so that order does not get counted multiple times.
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression.
The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression.
Print a single integer — the number of combinations modulo KaTeX can only parse string typed expression.
Input
3 5
1 2 5Output4ExplanationThe combinations are KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression.
Example 2:
Input
2 3
2 4Output0