题目描述
Problem Description
At Kyoto University, there are $ N $ lectures offered this semester, and you need to earn at least $ K $ credits to advance to the next level.
The number of credits assigned to the $ i $th lecture is $ a_i $. You want to advance with the minimum number of courses taken. Determine how many lectures you need to take.
Input Format
The input is given from the standard input in the following format:
$ N $ $ K $ $ a_1 $ $ a_2 $ $ ... $ $ a_N $
Output Format
Find the minimum number of courses needed. If you cannot earn enough credits even after taking all the lectures, output -1 instead.
Sample Input and Output
Sample Input #1
5 15
3 8 2 5 6
Sample Output #1
3
Sample Input #2
5 25
3 8 2 5 6
Sample Output #2
-1
Sample Input #3
4 20
1 1 20 19
Sample Output #3
1
Notes/Hints
Constraints
- $1 \leq N \leq 50$
- $1 \leq K \leq 1,000$
- $1 \leq a_i \leq 20$
- $ N $, $ K $, $ a_i $ are integers.
Sample Explanation 1
For example, you can take the $ 1 $, $ 2 $, and $ 4 $th lectures.
Sample Explanation 2
You cannot earn enough credits even after taking all the lectures.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分