Problem H
Server

You are in charge of a server that needs to run some
submitted tasks on a first-come, first-served basis. Each day,
you can dedicate the server to run these tasks for at most
Consider the following example. Assume
Input
The input consists of a single test case. The first line
contains two integers
Output
Display the number of tasks that can be completed in
Sample Input 1 | Sample Output 1 |
---|---|
6 180 45 30 55 20 80 20 |
4 |
Sample Input 2 | Sample Output 2 |
---|---|
10 60 20 7 10 8 10 27 2 3 10 5 |
5 |