After losing the execs vs. members jeopardy, the execs have lined up to be pied in the face by Derrick (totally consensually of course, why else would they be lined up?)
There are only minutes of the kickoff left for Derrick to pie all the execs. Of the execs in line, when it comes to their turn, the exec in line will run/hide/stall for minutes before accepting their fate and getting pied.
Derrick must pie the execs in the order they are lined up. However, before this, he must choose exactly one exec to remove from the line, to help him with the whipped cream. What is the maximum number of execs Derrick can pie in the time allotted?
Subtask 1 [50%]
Subtask 2 [50%]
No additional constraints.
The first line contains two integers, and .
The next line contains space-separated integers, the being .
Output a single integer, the maximum number of execs Derrick can pie.
2 7 3 1
Derrick can choose to remove the second exec from the line.
This allows him to spend minutes pieing the first and third execs, after which he runs out of time.