#P299. 练50.2 卡牌游戏 II
练50.2 卡牌游戏 II
Description
Xiaoming is playing a card game. He has cards, each with a positive integer written on it, representing the damage value of the card. When played, the card reduces the enemy's health by . The enemy's health is , and Xiaoming wins when the enemy's health becomes less than or equal to .
Xiaoming must use the cards in order to deal damage to the enemy. He wants to know how many cards he needs to use to win. If he cannot win even after using all cards, output .
Input Format
The first line contains two positive integers and (, ), representing the number of cards and the enemy's health.
The second line contains positive integers (), representing the damage value of each card. Xiaoming will use the cards in the order they are read.
Output Format
Output a single line containing an integer, representing the number of cards Xiaoming needs to use. If he cannot defeat the enemy even after using all cards, output .
Sample
3 5
2 3 42
Related
In following homework: