#t372. 书架
书架
Cow Stacking
Background
Special for beginners, ^_^
Problem Description
John recently bought a bookshelf to store books about dairy farming, but the bookshelf was quickly filled, leaving only the very top shelf empty.
John has cows in total (). Each cow has its own height (), and the total height of the cows is . The bookshelf has height ().
To reach the top of the bookshelf, the cows can step on each other's backs, stacking themselves like a pyramid, until their total height is at least the height of the bookshelf. Of course, the more cows are used, the more dangerous it is. To help John reach the top of the bookshelf, find the solution that uses the minimum number of cows.
Input Format
Line : two space-separated integers and .
Lines : line contains the integer .
Output Format
The minimum number of cows needed to reach the height of the bookshelf.
Sample Input 1
6 40
6
18
11
13
19
11
Sample Output 1
3
Constraints
1s, 1024KiB for each test case.