409447: GYM103562 B Watch Your Sugar!
Description
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?
InputThe 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$$$).
OutputPrint a single number - the maximum number of chocolates that Skariah can consume without going over his carbohydrate/sugar limit.
ExamplesInput1 4 5Output
0Input
5 5 1 2 3 4 5Output
2Note
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.