Inheritance

아직 제출이 없습니다시간 제한1.5초메모리 제한256 MB

문제

You are the proud owner of KK apples. You want to leave them as inheritance to your children and grandchildren. You have NN children. Each of these children has children of their own. The array grand\[]\mathit{grand}\[] describes this: its ii-th value is equal to the number of children your ii-th child has. So, your total number of grandchildren is equal to grand\[1]+grand\[2]++grand\[N]\mathit{grand}\[1] + \mathit{grand}\[2] + \ldots + \mathit{grand}\[N]. It is guaranteed that grand\[i]1\mathit{grand}\[i] \ge 1 for all 1iN1 \le i \le N.

You must decide how many apples you will give to each of your children. You must distribute all KK apples, none may remain. Also, you many only distribute whole apples. After you distribute the apples among your children, they will redistribute the apples between their children. Because you want to be as fair as possible, you want to find the minimum value DIFF\mathit{DIFF} such that:

  • The difference between the maximum number of apples given to a child and the minimum number of apples given to a child does not exceed DIFF\mathit{DIFF}.
  • The difference between the maximum number of apples given to a grandchild and the minimum number of apples given to a grandchild does not exceed DIFF\mathit{DIFF}.

Because your children are fair as well, you may assume that they will redistribute the apples given to them in such a way that DIFF\mathit{DIFF} will be kept as small as possible. It is, however, up to you to decide how many apples you will give to each direct child of yours.

Output the minimum possible value DIFF\mathit{DIFF} and the quantities of apples given to each child to achieve this value.

입력

The first line of input contains two integers NN and KK (1N1,000,0001 \le N \le 1\\,000\\,000, 1K10181 \le K \le 10^{18}).

The second line contains NN integers, the ii-th of them is grand\[i]\mathit{grand}\[i]. The total number of grandchildren does not exceed 21092 \cdot 10^9.

출력

The first line must contain the value DIFF\mathit{DIFF}. The second line must contain NN non-negative integers: the number of apples given to each child. The sum of these integers must be equal to KK. Any distribution of apples that leads to the correct value of DIFF\mathit{DIFF} will be accepted.

힌트

If you give 43 apples to your first child and 57 apples to your second child, they will split them in the following way. The first child will give all 43 apples to his only child. The second child will give 28 apples to one of her children and 29 apples to the other.

The maximum difference between apples received by children is 5743=1457 - 43 = 14. The maximum difference between apples received by grandchildren is 4328=1543 - 28 = 15.