PivotOJ

Neighborhood Watch

시간 제한: 1000ms메모리 제한: 512MB출처: ICPC Rocky Mountain Regional 2018BOJ 22285

문제

Jennifer was nominated to be neighborhood watch captain and is now in charge of managing the watch for her street. 

Jennifer's street consists of houses on only one side of the road. She has a plan of which houses will be a neighborhood watch house and wants to know how safe the plan is. A walk from one house to another house (not necessarily distinct) is considered safe if there is at least one house along the walk that is a neighborhood watch house. The safety rating of a plan is the number of walks that are safe on the street. Since a walk is either safe or not safe, when traveling in either direction, it is not counted twice in the safety rating.

Figure G.1: Sample input. One example of a safe walk is traveling from house 11 to house 55.

Tell Jennifer the safety rating of her plan.

입력

The first line of input contains two integers NN (1N2000001 \leq N \leq 200\,000), which is the number of houses on the street, and KK (0KN0 \leq K \leq N), which is the number of neighborhood watch houses in Jennifer's plan. The houses are numbered 1,,N1, \dots , N.

The next KK lines describe the neighborhood watch houses. Each of these lines contains a single integer HH (1HN1 \leq H \leq N), which is the house number of a neighborhood watch house. The house numbers are given in strictly increasing order.

출력

Display the safety rating of Jennifer's plan.

예제

예제 1

입력
5 2
1
4
출력
11
코드를 제출하려면 로그인하세요.