CSES - Traffic Lights | Đèn giao thông

View as PDF

Points: 1300 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

There is a street of length \(x\) whose positions are numbered \(0,1,\ldots,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,\ldots,p_n\): the position of each set of traffic lights. Each position is distinct.

Output

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

Constraints

  • \(1 \leq x \leq 10^9\)
  • \(1 \leq n \leq 2 \cdot 10^5\)
  • \(0<p_i<x\)

Example

Sample input

8 3  
3 6 2

Sample output
5 3 3


Comments

There are no comments at the moment.