408001: GYM102961 O Traffic Lights

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

O. Traffic Lightstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

There is a street of length $$$x$$$ whose positions are numbered $$$0,1,\dots,x$$$. Initially there are no traffic lights, but $$$n$$$ sets of traffic lights are added to the street one after another.

Your task is to calculate the length of the longest passage without traffic lights after each addition.

Input

The first input line contains two integers $$$x$$$ and $$$n$$$: the length of the street and the number of sets of traffic lights.

Then, the next line contains $$$n$$$ integers $$$p_1,p_2,\dots,p_n$$$: the position of each set of traffic lights. Each position is distinct.

Constraints:

  • $$$1 \le x \le 10^9$$$
  • $$$1 \le n \le 2\cdot 10^5$$$
  • $$$0 < p_i < x$$$
Output

Print the length of the longest passage without traffic lights after each addition.

ExampleInput
8 3
3 6 2
Output
5 3 3 

加入题单

算法标签: