Under construction

Still being built. Things may change

Flight Delays

Interview

Time limit2sMemory limit1024 MB

Summary
Given scheduled times t_i and a gap k, output each flight's departure: the max of t_i and the previous departure plus k.
Level

Easy2 of 10

Topics
Simulation, Array
Solved
No attempts yet

Problem

Alyona is leaving on a long-awaited vacation. She is so afraid of missing her flight that she arrived at the airport at time 00. The departure board shows nn flights. Flight number ii (numbered from 1) must depart at time tit_i, and ti>ti−1t_i > t_{i-1} for all i≥2i \geq 2.

Unpredictable weather in city N has just brought heavy snow to the airport area. For safety, airport staff must clear snow from the runway after each flight departs, so the departure times of any two consecutive flights must differ by at least kk.

Alyona knows that flights depart in increasing order of their numbers. Each flight departs as early as possible, but no earlier than kk after the previous flight departs and no earlier than its scheduled time tit_i.

Alyona's mind is already on her vacation, so the task of finding the actual departure time of each flight falls to you. Flight 1 has no predecessor, so its runway does not need to be cleared.

Input

The first line contains two integers nn and kk (1≤n≤100 0001 \leq n \leq 100\,000, 1≤k≤1091 \leq k \leq 10^9), the number of flights waiting to depart and the minimum gap between the departure times of two consecutive flights needed for runway clearing.

The second line contains integers t1,t2,…,tnt_1, t_2, \ldots, t_n (1≤t1<t2<…<tn≤10181 \leq t_1 < t_2 < \ldots < t_n \leq 10^{18}), the scheduled departure times.

Output

Print nn integers. The ii-th integer is the actual departure time of flight ii.

Hint

Look at the first example from the statement.

  1. The first flight departs on schedule.
  2. The second flight is delayed because the runway must be cleared.
  3. The planned gap between the third and second flights is enough for the third flight to leave on time, despite the second flight's delay and the clearing.
  4. The fourth flight departs on time.
  5. The fifth flight must be delayed, because the planned gap between it and the fourth flight was not large enough.
  6. The planned gap between the fifth and sixth flights was enough for clearing, but since the fifth flight was delayed, the sixth flight also departs late.

Examples1

  1. Example 1

    Input
    6 3
    1 2 7 10 12 15
    
    Expected output
    1 4 7 10 13 16