Gas Stations
Practice
2.4 (121 votes)
Approved
Easy
Math
Number theory
Problem
92% Success 9672 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Xenny's is competing in a race and his car has X litres of fuel. There are N milestones in the competition. It takes no fuel at all to travel between gas stations, but at the \(i^{th}\) gas station, \(P_i\) amount of petrol is drained.

Find the number milestones Xenny crosses before his car gets out of fuel.

Input

The first line of input consists of 2 space-separated integers - N and X.

The second line contains N space-separated integers - \(P_i\)

Output

Print a single integer - the number of milestones Xenny crosses.

Constraints

\(1 \le N \le 100\)

\(1 \le X \le 10^9\)

\(1 \le P_i \le 10^9\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
18 votes
Tags:
AlgorithmsDepth First SearchGraphs
Points:20
7 votes
Tags:
AlgorithmsDepth First SearchEasyGraphsTrees
Points:20
66 votes
Tags:
ApprovedDepth First SearchDisjoint setEasyGraphsOpen