K, S = list(map(int, input().split()))

ans = 0

for i in range(K+1):

	for j in range(K+1):

		if 0 <= S-(i+j) <= K:

			ans += 1



print(ans)
import numpy as np

K, S = list(map(int, input().split()))



x1 = np.ones(K+1, np.int32)

x2 = np.convolve(x1,x1)

x3 = np.convolve(x1,x2)

ans = x3[S]

print(ans)
K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
    for j in range(K + 1):
        if 0 <= S - (i + j) <= K:
            ans += 1
print(ans)

import numpy as np

K, S = list(map(int, input().split()))
x1 = np.ones(K + 1, np.int32)
x2 = np.convolve(x1, x1)
x3 = np.convolve(x1, x2)
ans = x3[S]
print(ans)

+import numpy as np + -ans = 0 -for i in range(K + 1): -    for j in range(K + 1): -        if 0 <= S - (i + j) <= K: -            ans += 1 +x1 = np.ones(K + 1, np.int32) +x2 = np.convolve(x1, x1) +x3 = np.convolve(x1, x2) +ans = x3[S]