#T304. 书架
书架
Description
John recently bought a bookshelf to store his cattle farming books, but the bookshelf quickly filled up, leaving only the top layer empty. John has a total of N cows (1 ≤ N ≤ 20,000), each with its own height Hi (1 ≤ Hi ≤ 10,000). The combined height of all N cows is S. The height of the bookshelf is B (1 ≤ B ≤ S < 2,000,000,007).
To reach the top of the bookshelf, the cows can stand on each other's backs, forming a sort of pyramid, until their total height is no less than the bookshelf's height. Of course, the more cows used, the greater the risk. To help John reach the top of the bookshelf, find the solution that uses the minimum number of cows.
Input Format
- Line 1: Two space-separated integers, N and B.
- Lines 2 to N+1: Line i+1 contains the integer Hi.
Output Format
The minimum number of cows required to reach or exceed the bookshelf's height.
6 40
6
18
11
13
19
11
3