atcoder#ABC272E. [ABC272E] Add and Mex

[ABC272E] Add and Mex

Score : 500500 points

Problem Statement

You are given an integer sequence A=(A1,A2,,AN)A=(A_1,A_2,\ldots,A_N) of length NN.

Perform the following operation MM times:

  • For each i (1iN)i\ (1\leq i \leq N), add ii to AiA_i. Then, find the minimum non-negative integer not contained in AA.

Constraints

  • 1N,M2×1051\leq N,M \leq 2\times 10^5
  • 109Ai109-10^9\leq A_i\leq 10^9
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \ldots ANA_N

Output

Print MM lines.

The ii-th (1iM)(1\leq i \leq M) line should contain the minimum non-negative integer not contained in AA after the ii-th operation.

3 3
-1 -1 -6
2
2
0

The 11-st operation makes the sequence AA

(1+1,1+2,6+3)=(0,1,3).(-1 + 1, -1 +2 ,-6+3) = (0,1,-3).

The minimum non-negative integer not contained in AA is 22.

The 22-nd operation makes the sequence AA

(0+1,1+2,3+3)=(1,3,0).(0 + 1, 1 +2 ,-3+3) = (1,3,0).

The minimum non-negative integer not contained in AA is 22.

The 33-rd operation makes the sequence AA

(1+1,3+2,0+3)=(2,5,3).(1 + 1, 3 +2 ,0+3) = (2,5,3).

The minimum non-negative integer not contained in AA is 00.

5 6
-2 -2 -5 -7 -15
1
3
2
0
0
0