Description
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200200 points
Problem Statement
Takahashi has NN days of summer vacation.
His teacher gave him MM summer assignments. It will take A_iAi days for him to do the ii-th assignment.
He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.
What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?
If Takahashi cannot finish all the assignments during the vacation, print -1 instead.
Constraints
-
1 \leq N \leq 10^61≤N≤106
-
1 \leq M \leq 10^41≤M≤104
-
1 \leq A_i \leq 10^41≤Ai≤104
Input
Input is given from Standard Input in the following format:
NNMMA_1A1......A_MAM
Output
Print the maximum number of days Takahashi can hang out during the vacation, or -1.
HINT
For example, he can do the first assignment on the first 55 days, hang out on the next 3030 days, and do the second assignment on the last 66 days of the vacation. In this way, he can safely spend 3030 days hanging out.