Problem Statement
There is a narrow straight road of length $L$ stretching east to west. Two travelers will visit this road. Along the road, there are $N$ rest areas. The distance from the west end of the road to the $i$-th rest area is $a_i$ (no rest area is at either end of the road). The road is so narrow that the two travelers cannot pass each other or walk side by side except at the rest areas.
The two travelers will take a trip along the road as follows.
- At time
$0$, each traveler starts at a rest area of their choice (the two may start at the same rest area). Then, each visits both ends of the road, and returns to their own starting rest area.
During the trip, they can walk along the road at a speed of at most $1$, or rest at a rest area. As long as they only pass each other at the rest areas, it is always allowed to change direction. What is the smallest number of seconds needed for both travelers to visit both ends of the road and return to their starting rest areas? It can be proved that the answer is always an integer under the Constraints of this problem.
Constraints
$1 \leq N \leq 2 \times 10^5$$1 \leq L \leq 10^9$$0 < a_1 < a_2 < \ldots < a_N < L$- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
N L
a_1 a_2 \ldots a_N
Output
Print the answer as an integer.
样例
2 6
2 5
14
2 3
1 2
6
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。