#P2842. 纸币问题 1
纸币问题 1
Problem Description
A country has types of banknotes. Each type has denomination , and there are infinitely many banknotes of each type. Now you need to make up an amount of . What is the minimum number of banknotes needed to make up this amount? (It is guaranteed that the amount can be made up.)
Input Format
The first line contains two integers , representing the number of banknote types and the target amount to make up.
The second line contains integers separated by spaces: , representing the denominations of these types of banknotes in order.
Output Format
One line with one integer, representing the minimum number of banknotes used.
6 15
1 5 10 20 50 100
2
3 15
1 5 11
3
Hint
For of the testdata, and .
For of the testdata, and .
Constraints
Translated by ChatGPT 5