#T421. 货币系统

货币系统

Description

Given a monetary system with n denominations of currency, determine how many different ways there are to compose an amount m. Example: Let n=3, m=10, the required input and output formats are as follows:

Input Format

  • The first line contains two integers n and m (m <= 5000).
  • The following n lines each contain an integer, where the (i+1)-th line represents the denomination of the i-th currency.

Output Format

A single integer representing the number of possible combinations.

3 10
1
2
5
10
## Source

CodesOnline

The translation maintains the original markdown heading format (## for H2) and the code block structure. The content "CodesOnline" is kept as-is since it appears to be a proper name or brand term that typically doesn't require translation. The overall structure and formatting are preserved exactly as in the source text.