#P6284. Pero's Data Package

    ID: 19502 Type: Default 1000ms 256MiB

Pero's Data Package

Pero's Data Package

Pero purchased a data package to surf the internet. Every month, he receives \( x \) MB of data. Any unused data is rolled over to the following month. Given the data usage for the first \( n \) months, calculate how many MB of data will be available in the \( n+1 \)-th month.

The available data for the \( n+1 \)-th month is computed as:

\( (n+1)\times x - \sum_{i=1}^{n}a_i \)

inputFormat

The input consists of two lines. The first line contains two integers ( x ) and ( n ), where ( x ) is the monthly data allowance (in MB) and ( n ) is the number of months. The second line contains ( n ) integers representing the data (in MB) used in each of the first ( n ) months.

outputFormat

Output a single integer representing the amount of data (in MB) available in the ( n+1 )-th month.

sample

10 3
10 10 10
10