#1255
Unrated
Tarifa
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Pero has negotiated a Very Good data plan with his internet provider. The provider will let Pero use up X megabytes to surf the internet per month. Each megabyte that he doesn’t spend in that month gets transferred to the next month and can still be spent. Of course, Pero can only spend the megabytes he actually has. If we know how much megabytes Pero has spent in each of the first N months of using the plan, determine how many megabytes Pero will have available in the N + 1 month of using the plan.

입력

The first line of input contains the integer X (1 ≤ X ≤ 100). The second line of input contains the integer N (1 ≤ N ≤ 100). Each of the following N lines contains an integer PiP_{i} (0 ≤ PiP_{i} ≤10 000), the number of megabytes spent in each of the first N months of using the plan. Numbers PiP_{i} will be such that Pero will never use more megabytes than he actually has.

출력

The first and only line of output must contain the required value from the task.

예제 입력 1

10
3
4
6
2

예제 출력 1

28

예제 입력 2

10
3
10
2
12

예제 출력 2

16

예제 입력 3

15
3
15
10
20

예제 출력 3

15
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.