P28633 [洛谷] Coin Problem 1
普及
题目描述

Problem Description

In a certain country, there are $n$ types of banknotes, each with a denomination of $a_i$ and an unlimited supply. The task is to凑出 an amount of $w$ using the fewest number of banknotes.

Input Format

The first line contains two integers $n$ and $w$, representing the number of types of banknotes and the amount to be凑出, respectively.
The second line contains $n$ integers separated by spaces, $a_1, a_2, a_3, \dots, a_n$, representing the denominations of the $n$ types of banknotes.

Output Format

A single line containing an integer, representing the minimum number of banknotes used.

Sample Input and Output

Sample Input #1

6 15
1 5 10 20 50 100

Sample Output #1

2

Sample Input #2

3 15
1 5 11

Sample Output #2

3

Notes

For $40\%$ of the test cases, $n \le 10$ and $w \le 100$.
For $100\%$ of the test cases, $1 \le n \le 10^3$ and $1 \le a_i \le w \le 10^4$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 15 1 5 10 20 50 100
样例输出
2