100 atcoder#ABC208C. [ABC208C] Fair Candy Distribution

[ABC208C] Fair Candy Distribution

Score : 300300 points

Problem Statement

There are NN citizens in the Kingdom of Takahashi. Each citizen has a national ID number; the ID of the ii-th citizen is aia_i. Here, all aia_i are pairwise different.

Takahashi has KK pieces of sweets. He has decided to hand out these pieces to the citizens in the following way until he has no more pieces.

  • When he has NN or more pieces, hand out one piece to every citizen.
  • Otherwise, let KK' be the number of pieces he has at the moment, and hand out one piece to each of the citizens with the KK' smallest IDs.

When all pieces are handed out, how many pieces will the ii-th citizen have?

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 1K10181 \leq K \leq 10^{18}
  • 1ai1091 \leq a_i \leq 10^9
  • All aia_i are pairwise different.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK

a1a_1 a2a_2 \ldots aNa_N

Output

Print NN lines. The ii-th line should contain the number of pieces of sweets received by the ii-th citizen.

2 7
1 8
4
3

Takahashi will hand out the pieces as follows.

  • Hand out one piece to everyone, leaving Takhashi with 55 pieces.
  • Hand out one piece to everyone, leaving Takhashi with 33 pieces.
  • Hand out one piece to everyone, leaving Takhashi with 11 piece.
  • Hand out one piece to the 11-st citizen, leaving Takhashi with no pieces.

In the end, the 11-st citizen will receive 44 pieces, and the 22-nd citizen will receive 33 pieces.

1 3
33
3

Since there is just one citizen, Takahashi will hand out all pieces to that 11-st citizen.

7 1000000000000
99 8 2 4 43 5 3
142857142857
142857142857
142857142858
142857142857
142857142857
142857142857
142857142857