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

print((sum(0 <= S - (x + y) <= K for y in range(K + 1) for x in range(K + 1))))

import numpy as np

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

arrange = np.arange(K + 1)

T = S - np.add.outer(arrange, arrange)

print((((T >= 0) & (T <= K)).sum()))
K, S = list(map(int, input().split()))
print((sum(0 <= S - (x + y) <= K for y in range(K + 1) for x in range(K + 1))))

import numpy as np

K, S = list(map(int, input().split()))
arrange = np.arange(K + 1)
T = S - np.add.outer(arrange, arrange)
print((((T >= 0) & (T <= K)).sum()))

+import numpy as np + -print((sum(0 <= S - (x + y) <= K for y in range(K + 1) for x in range(K + 1)))) +arrange = np.arange(K + 1) +T = S - np.add.outer(arrange, arrange) +print((((T >= 0) & (T <= K)).sum()))