# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Arithmetic Sequence (Easy)

Arithmetic Sequence is a sequence of numbers where the difference between two consecutive numbers are same. For example, the sequence 2, 4, 6, 8, 10, …. n is an arithmetic sequence where the difference between consecutive numbers is 2.

Carl Friedrich Gauss is known to be one of the best mathematician of all time. A story about his childhood goes like this: When Gauss was nine years old, his teacher asked him to add numbers from 1 to 100, thinking it would keep Gauss busy for a while. But Gauss came up with the answer very quickly instead. He found the following observation very helpful while solving the problem:

1 + 2 + 3 + 4 + 5 + …… + 100

100 + 99 + 98 + 97 + 96 + ……..+ 1

(100+1) + ( 99+2) + ( 98+3) + ( 97+4)+(96+5)+………. + ( 1 + 100 )

101 + 101 + 101 + 101 + 101 + ……. + 101

Since there are 100 terms each having the value of 101, the answer should be ( 100 * 101 ) / 2, because each number from 1 to 100 were added twice in this summation. So, if a person is given n, he can easily calculate the sum from 1 to n with a simple formula.

In this problem, you will be given an integer **N**, you will have to find the summation of integers from **1** to **N**. To make a the problem a bit more challenging, you will also be asked to subtract some of the numbers from this summation.

## Input

The first line contains an integer **N** **( 1 ≤ N ≤ 100 )**, the length of the arithmetic sequence. The next line will contain an integer **M** **( 1 ≤ M ≤ N )**, the amount of numbers that will be subtracted from the sequence. The following **M** lines will have **M** integers **M _{i}**

**(1 ≤ M**, the numbers that will be subtracted from the sequence. Each of these

_{i}≤ N)**M**numbers will be

**unique**.

## Output

Output a **single** integer, the result of the arithmetic sequence after subtracting the given numbers.

## Samples

Input | Output |
---|---|

3 1 3 | 3 |

Input | Output |
---|---|

3 2 1 2 | 3 |

98% Solution Ratio

aminulEarliest,

fsshakkhorFastest, 0.0s

m_ronyLightest, 0 B

FahimSifnatulShortest, 72B

Login to submit