PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#CC0000030. Đoạn đường dài nhất chưa có đèn (Traffic Lights)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

3 lộ trình

Đoạn đường dài nhất chưa có đèn (Traffic Lights)

Traffic Lights

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

A street extends from coordinate 00 to coordinate xx. Initially there are no traffic lights. Add nn traffic lights one by one at distinct interior positions. After each addition, determine the length of the longest interval without a light between consecutive lights or between a light and an endpoint.

Input

The first line contains x,nx,n. The second line contains the nn pairwise distinct positions p1,…,pnp_1,\ldots,p_n in insertion order.

Output

Print nn integers, separated by spaces: the longest gap after each insertion.

Subtasks

  • Subtask 1 (20 points): 1≤x≤1091\le x\le10^9; 1≤n≤201\le n\le 20; 0<pi<x0<p_i<x; all pip_i are distinct.
  • Subtask 2 (30 points): 1≤x≤1091\le x\le10^9; 1≤n≤9001\le n\le 900; 0<pi<x0<p_i<x; all pip_i are distinct.
  • Subtask 3 (50 points): 1≤x≤1091\le x\le10^9; 1≤n≤2000001\le n\le 200000; 0<pi<x0<p_i<x; all pip_i are distinct.

Examples

Input

8 3
3 6 2

Output

5 3 3

Explanation

After insertions at 3,6,2, the largest gap lengths are 5,3,3.