Polycarp has n dice d_1, d_2, ..., 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, ..., 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 ≤ n ≤ 2·10^5, n ≤ A ≤ s) — the number of dice and the sum of shown values where s = d_1 + d_2 + ... + d_{n}.

The second line contains n integers d_1, d_2, ..., d_{n} (1 ≤ d_{i} ≤ 10^6), where d_{i} is the maximum value that the i-th dice can show.


-----Output-----

Print n integers b_1, b_2, ..., b_{n}, where b_{i} is the number of values for which it is guaranteed that the i-th dice couldn't show them.


-----Examples-----
Input
2 8
4 4

Output
3 3 
Input
1 3
5

Output
4 
Input
2 3
2 3

Output
0 1 


-----Note-----

In the first sample from the statement A equal to 8 could be obtained in the only case when both the first and the second dice show 4. Correspondingly, both dice couldn't show values 1, 2 or 3.

In the second sample from the statement A equal to 3 could be obtained when the single dice shows 3. Correspondingly, it couldn't show 1, 2, 4 or 5.

In the third 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.

Difficulty: interview

Starter code:

Solutions:
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))

total = sum(a)

ans = []
for i in range(n):
    high = s - (total - a[i])
    low = s - (n - 1)
    
    cur = 0
    if low <= a[i]:
        cur += a[i] - low
    if high > 0:
        cur += high - 1

    ans.append(cur)

print(' '.join(map(str, ans)))


n,A=map(int,input().split())
d=[int(x) for x in input().split()]
x=sum(d)
b=[]

for i in range(n):
	b.append(d[i]-min(d[i],A-n+1)+max(A-x+d[i],1)-1)
print(''.join([str(b[i])+' ' for i in range(n)]))

a, b = list(map(int, input().split(' ')))
x=list(map(int, input().split(' ')))
s = sum(x)
t = []
for i in range(a):
    minx = b-(a-1)
    maxx = b-(s - x[i])
    xx = 0
    if min(minx, maxx)>0:
        xx += (min(minx, maxx)-1)
    if max(minx, maxx)<x[i]:
        xx += x[i] - (max(max(minx, maxx), 0))
    t.append(xx)
print(' '.join([str(x) for x in t]))


n,a=[int(x) for x in input().split()]
val=[int(x) for x in input().split()]
vsum=0
for i in val:
	vsum+=i
ans=[0]*n
for i in range(n):
	if a-(vsum-val[i])>1:
		ans[i]+=a-(vsum-val[i])-1
	if val[i]>a-n+1:
		ans[i]+=val[i]-(a-n+1)
for i in ans:
	print(i,end=' ')


n, A = map(int, input().split())
d = list(map(int, input().split()))

s = 0
for x in d:
    s += x

for i in range(n):
    print(d[i] - (min(d[i], A - n + 1) - max(A - s + d[i], 1) + 1), end=' ')


n, a = list(map(int, str.split(input())))
ns = tuple(map(int, str.split(input())))
s = sum(ns)
res = []
for x in ns:

    low = max(0, a - (s - x) - 1)
    high = min(x, a - (n - 1))
    res.append(low + x - high)

print(str.join(" ", list(map(str, res))))


n, A = map(int,input().split())
kosti = list(map(int,input().split()))
summ = 0
temp = 0
for i in kosti:
    summ += i
for i in kosti:
    temp = summ - i
    temp2 = min(A-(n-1),i)
    ans = i - temp2 + max(0,A - temp - 1)
    print(ans,end=" ")


n, a = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
s = 0
for i in t:
    s+=i
k = []
for i in range(n):
    k.append(0)
    if s-a < t[i]:
        k[i]+=t[i]-s+a-1
    if t[i] - (a - n+1) > 0:
        k[i]+=(t[i] - (a - n+1))
print(*k)


n, a = map(int, input().split())
d = list(map(int, input().split()))
b = [0 for i in d]
s = sum (d)
if n == 1:
    print (d[0] - 1)
else:
    for i in range(len(d)):
        if s - d[i] < a:
            b[i] += a - s + d[i] - 1
        if d[i] > a - n + 1:
            b[i] += d[i] - a + n - 1
    print (*b)

n, A = map(int, input().split())
d = list(map(int, input().split()))
s = sum(d)
for i in range(n):
    k = max(A + d[i] - s - 1, 0)
    l = max(d[i] - A + n - 1, 0)
    print(k + l, end = ' ')



n, a = [int(next_token) for next_token in input().split()]
d = [int(next_token) for next_token in input().split()]
s = sum(d)
ans = []
for i in range(n):
    k_min = max(a - s + d[i], 1)
    k_max = min(a - n + 1, d[i])
    ans.append(k_min - 1 + d[i] - k_max)
print(' '.join(map(str, ans)))

a, b = map(int, input().split(' '))
x=list(map(int, input().split(' ')))
s = sum(x)
t = []
for i in range(a):
    minx = b-(a-1)
    maxx = b-(s - x[i])
    xx = 0
    if min(minx, maxx)>0:
        xx += (min(minx, maxx)-1)
    
    if max(minx, maxx)<x[i]:
        xx += x[i] - (max(minx, maxx))
    t.append(xx)
print(' '.join([str(x) for x in t]))

n, A = map(int, input().split())
d = list(map(int, input().split()))
s = sum(d)
for i in range(n):
    k = max(A + d[i] - s - 1, 0)
    l = max(d[i] - A + n - 1, 0)
    print(k + l, end = ' ')

[n, A] = [int(x) for x in input().split()]

d = [0] + [int(x) for x in input().split()]

sigma = sum(d)

ans = [0] * (n + 1)

for i in range(1, n + 1):
    at_least = A - sigma + d[i] - 1
    at_least = max(at_least, 0)
    ans[i] += at_least

    at_most = d[i] - A + n - 1
    at_most = max(at_most, 0)
    ans[i] += at_most

ans = ans[1:]
ans = [str(x) for x in ans]
print(" ".join(ans))












n, a = map(int, input().split())
d = list(map(int, input().split()))
s = sum(d)
ans = []
for i in range(n):
    k_min = max(a - s + d[i], 1)
    k_max = min(a - n + 1, d[i])
    ans.append(k_min - 1 + d[i] - k_max)
print(' '.join(map(str, ans)))

n,a,*d=[int(x) for x in input().split()+input().split()]
sd=sum(d)
for e in d:
    t=0 if a-(sd-e)-1<0 else a-(sd-e)-1
    b=0 if e+(n-1-a)<0 else e+(n-1-a)
    print(t+b,'',end='')

3

import sys

n, A = list(map(int, sys.stdin.readline().split()))
d = list(map(int, sys.stdin.readline().split()))

s = sum(d)

for x in d:
    z = min(A - n + 1, x) - max(1, A - s + x) + 1
    if z < 0:
        z = 0
    sys.stdout.write("%d " % (x - z))

sys.stdout.write('\n')


3

import sys

n, A = list(map(int, sys.stdin.readline().split()))
d = list(map(int, sys.stdin.readline().split()))

s = sum(d)

for x in d:
    z = min(A - n + 1, x) - max(1, A - s + x) + 1
    if z < 0:
        z = 0
    sys.stdout.write("%d " % (x - z))

sys.stdout.write('\n')


n,a = list(map(int,input().split()))
d = list(map(int,input().split()))
s = sum(d)
ans = []
for i in range(n):
        l = max(1,a-(s-d[i]))
        r = min(d[i],a-(n-1))
        ans.append(d[i]-(r-l+1))
print(' '.join(map(str,ans)))


R = lambda:list(map(int,input().split()))
n,a = R()
b = list(R())
sum = 0
for i in range(n):
    sum += b[i]
for i in range(n):
    print((b[i]-min(b[i],a-n+1)+max(1,a-sum+b[i])-1), end=' ')




n, a = map(int, input().split())
b = list(map(int, input().split()))
ans = [0] * n
k = a - (n - 1)

if n == 1:
    print(b[0] - 1)
    return
elif a % n == 0:
    d = a // n
    if b.count(d) == n:
        ans = [d - 1] * n
        print(*ans)
        return
s = sum(b)
for i in range(n):
    if k < b[i]:
        ans[i] += (b[i] - k)
    if (s - a) < b[i]:
        ans[i] += a - (s - b[i]) - 1

print(*ans)

n,A = map(int,input().split())
d =  [int(x) for x in input().split()]
s = sum(d)
ans = []
for i in d:
	ss = A - n + 1 #require when another 1
	sd = s - i - (n - 1) #another +-
	if(ss <= 0 or A > s):
		ans.append(i)
	else:
		l = max(A - s + i,1)
		r = min(ss,i)
		ans.append(i-r+l-1)
print(''.join([str(ans[i])+' 'for i in range(n)]))

[n,A]=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
tot=0
for x in a:
	tot+=x
for x in a:
	up=min(x,A-(n-1))
	down=max(A-(tot-x),1)
	#print(up,down)
	print(x-(up-down+1),end=" ")
print()