#2395 Polycarpus

1 s   128 MB  

Description

Polycarp has $n$ dice $d_1, d_2, \dots , d_n$. The $i$-th dice shows numbers from 1 to $d_i$. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn't see which dice showed what number, she knows only the sum A and the values $d_1, d_2, \dots , d_n$. However, she finds it enough to make a series of statements of the following type: dice $i$ couldn't show number $r$. For example, if Polycarp had two six-faced dice and the total sum is A = 11, then Agrippina can state that each of the two dice couldn't show a value less than five (otherwise, the remaining dice must have a value of at least seven, which is impossible). For each dice find the number of values for which it can be guaranteed that the dice couldn't show these values if the sum of the shown values is A.

Input

The first line contains two integers $n, A (1 \leq n \leq 2*10^5, n \leq A \leq s)$ — the number of dice and the sum of shown values where $s = d_1 + d_2 + \dots + d_n$. The second line contains $n$ integers $d_1, d_2, \dots , d_n (1 \leq d_i \leq 10^6)$, where $d_i$ is the maximum value that the $i$-th dice can show.

Output

Print $n$ integers $b_1, b_2, \dots , b_n$, where $b_i$ is the number of values for which it is guaranteed that the $i$-th dice couldn't show them.

Sample Input

Sample Output

2 3
2 3
0 1

HINT

In sample from the statement A equal to 3 could be obtained when one dice shows 1 and the other dice shows 2. That's why the first dice doesn't have any values it couldn't show and the second dice couldn't show 3.

Source

Codeforces Round 298(Div.2) / (link) http://codeforces.com/problemset/problem/534/C