#abc358b. B - Ticket Counter

B - Ticket Counter

Score : 200200 points

问题陈述

在AtCoder Land的入口处,有一个单独的售票亭,游客们会排队依次购买门票。购买过程每人需要AA秒。一旦队伍前面的人完成购票,下一个人(如果有的话)会立即开始他们的购买过程。

目前,售票亭前没有人排队,将会有NN人依次来购买门票。具体来说,第ii个人将在从现在开始的TiT_i秒后到达售票亭。如果已经有队伍,他们会加入队伍的末尾;如果没有,他们将立即开始购买过程。这里,T1<T2<<TNT_1 < T_2 < \dots < T_N

对于每个i (1iN)i\ (1 \leq i \leq N),确定从现在开始第ii个人完成购票需要多少秒。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

At the entrance of AtCoder Land, there is a single ticket booth where visitors line up to purchase tickets one by one. The purchasing process takes AA seconds per person. Once the person at the front of the line finishes purchasing their ticket, the next person (if any) immediately starts their purchasing process.

Currently, there is no one in line at the ticket booth, and NN people will come to buy tickets one after another. Specifically, the ii-th person will arrive at the ticket booth TiT_i seconds from now. If there is already a line, they will join the end of it; if not, they will start the purchasing process immediately. Here, T1<T2<<TNT_1 < T_2 < \dots < T_N.

For each i (1iN)i\ (1 \leq i \leq N), determine how many seconds from now the ii-th person will finish purchasing their ticket.

Constraints

  • 1N1001 \leq N \leq 100
  • 0T1<T2<<TN1060 \leq T_1 < T_2 < \dots < T_N \leq 10^6
  • 1A1061 \leq A \leq 10^6
  • All input values are integers.

Input

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

NN AA

T1T_1 T2T_2 \dots TNT_N

Output

Print NN lines. The ii-th line should contain the number of seconds from now that the ii-th person will finish purchasing their ticket.

Sample Input 1

3 4
0 2 10

Sample Output 1

4
8
14

The events proceed in the following order:

  • At 00 seconds: The 1st person arrives at the ticket booth and starts the purchasing process.
  • At 22 seconds: The 2nd person arrives at the ticket booth and joins the line behind the 1st person.
  • At 44 seconds: The 1st person finishes purchasing their ticket, and the 2nd person starts the purchasing process.
  • At 88 seconds: The 2nd person finishes purchasing their ticket.
  • At 1010 seconds: The 3rd person arrives at the ticket booth and starts the purchasing process.
  • At 1414 seconds: The 3rd person finishes purchasing their ticket.

Sample Input 2

3 3
1 4 7

Sample Output 2

4
7
10

The events proceed in the following order:

  • At 11 second: The 1st person arrives at the ticket booth and starts the purchasing process.
  • At 44 seconds: The 1st person finishes purchasing their ticket, and the 2nd person arrives at the ticket booth and starts the purchasing process.
  • At 77 seconds: The 2nd person finishes purchasing their ticket, and the 3rd person arrives at the ticket booth and starts the purchasing process.
  • At 1010 seconds: The 3rd person finishes purchasing their ticket.

Sample Input 3

10 50000
120190 165111 196897 456895 540000 552614 561627 743796 757613 991216

Sample Output 3

170190
220190
270190
506895
590000
640000
690000
793796
843796
1041216