CSEC-CPD_DIV2basicGraph

Start

2021-12-28 09:30 AKST

CSEC-CPD_DIV2basicGraph

End

2021-12-31 09:30 AKST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -149 days 12:32:20

Time elapsed

72:00:00

Time remaining

0:00:00

Problem G
Cinema Crowds

The United Cinema Crowd Association of Stockholm plans to have a showing of Old computer scientists and their pieings at the local KTH Royal Institute of Technology cinema.

Not until far too late did the auditor of the association point out that the board had booked far too many groups of visitors to the theater, which fits at most $N$ visitors.

In total, $M$ groups of visitors signed up for the showing. It was decided to let the groups enter the theater one at a time, in the same order in which they signed up for the showing. If there are too few empty seats when a group comes, the group gets angry and leaves.

Given the sizes of all the visiting groups, determine how many groups will not be accepted into the theater.

Input

The first line of the input contains the integers $N$ ($1 \le N \le 100$) and $M$ ($1 \le M \le 50$), the number of seats in the theater and the number of visiting groups.

The second line contains $M$ integers – the size of each visiting group in the order in which they signed up for the showing. A group consists of between $1$ and $10$ visitors.

Output

Output a single number – the number of groups that will not be accepted to the showing.

Sample Input 1 Sample Output 1
10 5
1 2 3 4 5
1
Sample Input 2 Sample Output 2
1 10
1 1 1 1 1 1 1 1 1 1
9