409447: GYM103562 B Watch Your Sugar!

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Watch Your Sugar!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Skariah is looking forward to spending Valentine's Day with his girlfriend! His girlfriend of 5 years, Rachel, has gifted Skariah a box of chocolates every year in their relationship. Skariah believes that this year is no exception. This year, however, Skariah has adopted a new, low-carb diet. This diet requires that he eats no more than $$$s$$$ grams of sugar every day.

Given $$$n$$$ integers, where each integer represents the grams of sugar in one of the chocolates, what is the maximum number of chocolates that Skariah can consume without going over his carbohydrate/sugar limit?

Input

The first line of input represents $$$n$$$ ($$$1 \leq n \leq 10^5$$$), the number of chocolates in the gifted box. The next line of input, $$$s$$$ ($$$0 \leq s \leq 10^4$$$), represents Skariah's sugar limit. The last line, containing $$$n$$$ integers, represents the grams of sugar in each chocolate in the box. Each chocolate can have $$$x$$$ grams of sugar, where ($$$1 \leq x \leq 2000$$$).

Output

Print a single number - the maximum number of chocolates that Skariah can consume without going over his carbohydrate/sugar limit.

ExamplesInput
1
4
5
Output
0
Input
5
5
1 2 3 4 5
Output
2
Note

Test Case 1: The only chocolate available has more grams of sugar than allowed so we output 0.

Test Case 2: We can take the first two chocolates for a total of 3 grams of sugar. This is less than the sugar allowed of 5. However, we cannot eat another chocolate without consuming more than 5 grams, so we output 2.

加入题单

算法标签: