CodeEff/ECCO huggingface dataset:
# Original solution
K,S=list(map(int,input().split()))
K+=1
ans=0
a=max(0,S-2*K)
for i in range(a,K):
  if i>S:
    break
  for j in range(a,K):
    if i+j>S :
      break
    for k in range (a,K):
      if i+j+k>S:
        break
      if i+j+k==S:
        ans+=1
print(ans)

# Optimized solution
K,S=list(map(int,input().split()))
ans=0
#a=max(0,S-2*K)
for i in range(K+1):
  for j in range(K+1):
    if i+j+K>=S and i+j<=S :
      ans+=1

print(ans)
# Original solution
r=range;k,s=list(map(int,input().split()))
print((len([0 for x in r(k+1) for y in r(k+1) for z in r(k+1) if x+y+z==s])))

# Optimized solution
r=range;k,s=list(map(int,input().split()))
print((len([0 for x in r(k+1) for y in r(k+1) if 0<=s-x-y<=k])))
# Original solution
import sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                counter += 1
            else:
                continue

print(counter)

# Optimized solution
import sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S-i-j <= K:
            counter += 1
        else:
            continue

print(counter)
# Original solution
def main():
    K, S = list(map(int, input().split()))
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x + y + z == S:
                    cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    K, S = list(map(int, input().split()))
    cnt = 0
    for x in range(K+1):
        for y in range(K+1):
            z = S - x - y
            if 0 <= z and z <= K:
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()
# Original solution
import itertools

N, K = list(map(int, input().split()))
candidate = list(range(N+1))
comb = list(itertools.product(candidate, repeat=3))
l = [c for c in comb if sum(c) == K]

print((len(l)))

# Optimized solution
k, s = list(map(int, input().split()))

cnt = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z and z <= k:
            cnt += 1

print(cnt)
# Original solution
K, S = list(map(int, input().split()))
 
count = 0
for x in range(S+1):
  # print("x", x)
  for y in range(S-x+1):
    # print("y" , y)
    z = S - x - y
    # print("z", z)
    if (x>=0 and x<=K) and (y>=0 and y<=K) and (z>=0 and z<=K):
      count += 1
      
print(count)

# Optimized solution
K, S = list(map(int, input().split()))
 
count = 0

for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if (z>=0) and (z<=K):
      count += 1

print(count)
# Original solution
import bisect
k,s=list(map(int,input().split()))
ans=0
z=[i for i in range(k+1)]
for x in range(k+1):
    for y in range(k+1):
        a=s-x-y
        if a<=k and z[bisect.bisect_left(z,a)]==a:
            ans+=1
print(ans)

# Optimized solution
k,s=list(map(int,input().split()))
ans=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if 0<=z<=k:
            ans+=1
print(ans)
# Original solution
def main():
    K, S = list(map(int, input().split()))

    count = 0

    # X
    for i in range(K+1):
        # Y
        for j in range(K+1):
            # Z
            for k in range(K+1)[::-1]:
                if i + j + k == S:
                    count += 1
                if i + j + k < S:
                    break

    print(count)

main()

# Optimized solution
def main():
    K, S = list(map(int, input().split()))

    count = 0

    # X
    for i in range(K+1):
        # Y
        for j in range(K+1):
            if i + j > S:
                break
            if S-i-j > K:
                continue
            count += 1

    print(count)

main()
# Original solution

def resolve():
    ks = input().split(" ")
    k = int(ks[0])
    s = int(ks[1])

    n = 0

    for zz in range(k+1):
        for yy in range (k+1):
            for xx in range (k+1):
                if (xx+yy+zz == s):
                    n += 1

    print(n)

if __name__ == "__main__":
    resolve()

# Optimized solution

def resolve():
    ks = input().split(" ")
    k = int(ks[0])
    s = int(ks[1])

    n = 0

    for zz in range(k+1):
        for yy in range (k+1):
                if (0 <= s-(yy+zz) <= k):
                    n += 1

    print(n)

if __name__ == "__main__":
    resolve()
# Original solution
K, S = list(map(int, input().split()))

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if x + y + z == S:
                result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            result += 1

print(result)
# Original solution
k, s = list(map(int, input().split()))
arr = [[x, y, s-x-y] for x in range(k+1) for y in range(k+1) if k >= s-x-y >= 0]
print((len(arr)))

# Optimized solution
k, s = list(map(int, input().split()))
arr = [1 for x in range(k+1) for y in range(k+1) if k >= s-x-y >= 0]
print((sum(arr)))
# Original solution
import sys

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(eval(input()))


def read_str():
    return eval(input())


def main():
    k, s = read_int_list()
    res = 0
    for x in range(0, k + 1):
        for y in range(0, k + 1):
            for z in range(0, k + 1):
                if s == x + y + z:
                    res += 1
    print(res)


main()


# Optimized solution
import sys

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(eval(input()))


def read_str():
    return eval(input())


def main():
    k, s = read_int_list()
    res = 0
    for x in range(0, k + 1):
        for y in range(0, k + 1):
            z = s - (x + y)
            if 0 <= z <= k:
                res += 1
    print(res)


main()
# Original solution
K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
    pass
    for y in range(K + 1):
        pass
        for z in range(K + 1):
            if x + y + z == S:
                cnt += 1
print(cnt)


# Optimized solution
K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if z >= 0 and z <= K:
            cnt += 1
print(cnt)
# Original solution

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

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        for k in range(K+1) :
            if S == i + j + k :
                count += 1
print(count)


# Optimized solution

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

count = 0
for i in range(K+1) :
    for j in range(K+1) :
        if S < i + j :
            break
        if S - i - j <= K :
            count += 1

print(count)
# Original solution
K, S = list(map(int, input().split()))

success = 0

for x in range (K + 1):
    for y in range (K + 1):
        for z in range (K + 1):
            if x + y + z == S:
                success = success + 1

print(success)


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

success = 0

for x in range (K + 1):
    for y in range (K + 1):
        if S - x - y >= 0 and S - x - y <= K:
            success = success + 1

print(success)
# Original solution
import bisect

k,s=list(map(int, input().split()))

p=[]
for i in range(k+1):
    p.append(i)

ans=0
for x in range(k+1):
    for y in range(k+1):
           if p[bisect.bisect_right(p,s-x-y)-1]==s-x-y:
                ans+=1
print(ans)

# Optimized solution
k,s=list(map(int, input().split()))
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=(s-x-y)<=k:
            ans+=1
print(ans)
# Original solution
K, S = list(map(int, input().split()))

ans = 0

for i in range(0,K+1):
    for j in range (0,K+1):
        for k in range (0,K+1):
            if (i + j + k) == S:
                ans = ans + 1
                continue
            

print(ans)


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

ans = 0

for i in range(0,K+1):
    for j in range (0,K+1):
        if (S-K) <= (i + j) <= S:
            ans = ans + 1
            continue
            

print(ans)
# Original solution
k, s = list(map(int, input().split()))

ans = 0
three = [0, 0, 0]

for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            g = i + j + k
            if g == s:
                ans += 1
                 
print(ans)

# Optimized solution
k, s = list(map(int, input().split()))

ans = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k :
            ans += 1
                 
print(ans)
# Original solution
row = input().split()
K = int(row[0])
S = int(row[1])
count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if S == x+y+z:
                count += 1

print(count)

# Optimized solution
row = input().split()
K = int(row[0])
S = int(row[1])
count = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y <= K:
            count += 1

print(count)
# Original solution
K,S = list(map(int,input().split()))
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0<=z<=K:
            ans += 1
print(ans)

# Optimized solution
k,s = list(map(int,input().split()))
a = ((s+1)*(s+2))//2
b = ((s-k)*(s-k+1))//2
c = (((abs(s-k*3))+1)*((abs(s-k*3))+2))//2

if s <= k:
    print(a)
elif s <= k*2:
    print((a-b*3))
elif s <= k*3:
    print(c)
# Original solution
import itertools
K, S = [int(i) for i in input().split()]

count = 0
for i in range(0, K+1):
    for j in range(0, K+1):
        for k in range(0, K+1):
            if i+j+k == S:
                count += 1
    
print(count)

# Optimized solution
K, S = [int(i) for i in input().split()]

count = 0
for i in range(0, K+1):
    for j in range(0, K+1):
        k = S - i -j
        if 0 <= k <= K:
            count += 1
print(count)
# Original solution
k,s=list(map(int,input().split()))
cnt=0
for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):
            if i+j+m==s:
                cnt+=1
            else:
                pass
print(cnt)
    

# Optimized solution
k,s=list(map(int,input().split()))
cnt=0
for i in range(k+1):
    for j in range(k+1):
        z=s-i-j
        if z>=0 and z<=k:
            cnt+=1
print(cnt)
# Original solution
def solve():
    k, s = list(map(int, input().split()))
    c = 0
    for x in range(k + 1):
        for y in range(k + 1):
            for z in range(k + 1):
                if x + y + z == s:
                    c += 1
    return c


if __name__ == "__main__":
    print((solve()))


# Optimized solution
def solve():
    k, s = list(map(int, input().split()))
    c = 0
    for x in range(k + 1):
        for y in range(k + 1):
            if 0 <= s - (x + y) <= k:
                c += 1
    return c


if __name__ == "__main__":
    print((solve()))
# Original solution
cnt = 0
k, s = list(map(int,input().split()))
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i + j + l == s:
                cnt += 1
print(cnt)

# Optimized solution
k, s = list(map(int,input().split()))
cnt = 0
for i in range(k+1):
    for j in range(k+1):
        if 0 <= s - i - j <= k:
            cnt += 1
print(cnt)
# Original solution
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z:
                    ct += 6
                else:
                    ct += 3
                break;
print(ct)

# Optimized solution
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)
# Original solution
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)











# Optimized solution
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)
# Original solution
import itertools

K,S=list(map(int,input().split()))
a=list(range(K+1))
#print(a)
combi=list(itertools.product(a,repeat=3))
#print(combi)
print(([sum(combi[i]) for i in range(len(combi))].count(S)))

# Optimized solution
import itertools

K,S=list(map(int,input().split()))
combi=[]
num=0
for i in range(K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            if i+j+k==S:
                combi=[i,j,k]
                #print(combi)
                #print(set(itertools.permutations(combi)))
                t=set(itertools.permutations(combi))
                #print(len(t))
                num+=len(t)
print(num)
# Original solution
import itertools

K,S=list(map(int,input().split()))
combi=[]
num=0
for i in range(K+1):
    for j in range(K+1):
        if 0<=S-i-j<=K:
            combi=[i,j,S-i-j]
            #print(combi)
            #print(set(itertools.permutations(combi)))
            num+=1
print(num)

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

cnt=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                cnt += 1
print(cnt)

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

cnt=0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0<=z<=K:
            cnt += 1
print(cnt)
# Original solution
k, s = (int(i) for i in input().split())
count = 0

for i in range(k + 1):
    for j in range(k + 1):
        for k in range(k + 1):
            if i + j + k == s:
                count += 1

print(count)

# Optimized solution
k, s = (int(i) for i in input().split())
count = 0

for h in range(k + 1):
    for i in range(k + 1):
        j = s - i - h
        if 0 <= j <= k:
            count += 1
print(count)
# Original solution
K,S=list(map(int,input().split()))
ans=0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x+y+z==S: ans+=1
print(ans)

# Optimized solution
K,S=list(map(int,input().split()))
ans=0
for x in range(K+1):
  for y in range(K+1):
    z=S-x-y
    if 0<=z<=K: ans+=1
print(ans)
# Original solution
k, s = list(map(int, input().split()))
count=0
for i in range(k+1):
    for j in range(k+1):
        t = s-i-j
        if t <= k and t >= 0:
            count += 1
        else:
            pass
print (count)


# Optimized solution
k, s = list(map(int, input().split()))
count=0
for i in range(k+1):
    for j in range(k+1):
        t = s-i-j
        if t <= k and t >= 0:
            count += 1
print (count)
# Original solution
K,S=list(map(int,input().split()))
ans=0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x+y+z==S:
        ans+=1
print(ans)


# Optimized solution
r,g=list(map(int,input().split()))
X=0
for i in range(r+1):
  for j in range(r+1):
    k=g-i-j
    if k>=0 and k<=r:
      X+=1
print(X)
# Original solution
K, S = list(map(int, input().split()))

c = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if (x + y + z) == S:c+=1
print(c)

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

c = 0

for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - (x + y) <= K:c+=1
print(c)
# Original solution
k, s = list(map(int, input().split()))
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1
print(cnt)

# Optimized solution
k, s = list(map(int, input().split()))
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            cnt += 1
print(cnt)
# Original solution
k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans +=1
print(ans)

# Optimized solution
k, s = list(map(int, input().split()))
ans = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= (s-x-y) <=k:
                ans +=1
print(ans)
# Original solution
K, S = list(map(int, input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
          if x+y+z == S:
            count += 1
print(count)

# Optimized solution
K, S = list(map(int, input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        z = S - (x+y)
        if (z <= K) & (z >= 0):
            count += 1
print(count)
# Original solution
k, s = list(map(int, input().split(' ')))

count = 0
for x in range(0,k+1):
    for y in range(0, k+1):
        for z in range(0, k+1):
            if x + y + z == s:
                count += 1
                
print(count)

# Optimized solution
k, s = list(map(int, input().split(' ')))

count = 0
for x in range(0,k+1):
    for y in range(0, k+1):
        z = s - (x + y)
        if 0 <= z <= k:
            count +=1
                
print(count)
# Original solution
k,s = list(map(int, input().split()))

ans = 0
for x in range(k+1):
  for y in range(k+1):
    if x+y > s: break
    elif s-x-y <= k: ans += 1
print(ans)

# Optimized solution
k,s = list(map(int ,input().split()))

ans = 0
for x in range(k+1):
  for y in range(k+1):
    if 0 <= s - (x+y) <= k:
      ans += 1
print(ans)
# Original solution
K, S = list(map(int,input().split()))
ans = 0
for X in range(0, K+1):
    for Y in range(0, K+1):
        if 0 <= S - X - Y <= K:
            ans += 1
print(ans)

# Optimized solution
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)
# Original solution
k, s = list(map(int, input().split()))

ans = 0
for x in reversed(list(range(k+1))):
    for y in reversed(list(range(k+1))):
        for z in reversed(list(range(k+1))):
            if x+y+z == s:
                ans += 1
                break
            elif x+y+z < s:
                break
print(ans)

# Optimized solution
k, s = list(map(int, input().split()))

ans = 0
for x in reversed(list(range(k+1))):
    for y in reversed(list(range(k+1))):
        if s-(x+y) >= 0 and s-(x+y) <= k:
            ans += 1
print(ans)
# Original solution
import sys
K,S = list(map(int,input().split()))
X,Y,Z = 0,0,0
if K < 2 or K > 2500:
  sys.exit()
if X > K or Y > K or Z > K:
  sys.exit()
 
X = 0
count = 0
while X <= K:
  Y = 0
  while Y <= K:
    Z = 0
    while Z <= K:
      if X + Y + Z == S:
        count += 1
      Z += 1
    Y += 1
  X += 1
print(count)

# Optimized solution
import sys
K,S = list(map(int,input().split()))
if K < 2 or K > 2500:
  sys.exit()

X = 0
count = 0
while X <= K:
  Y = 0
  while Y <= K:
    Z = S - X - Y
    if Z <= K and Z >= 0:
      count += 1
    Y += 1
  X += 1
print(count)
# Original solution
k, s = list(map(int, input().split()))

count = 0

for i in range(k + 1):
    for j in range(k + 1):
        for k in range(k + 1):
            if i + j + k == s:
                count += 1
            else:
                pass

print(count)

# Optimized solution
k, s = list(map(int, input().split()))

count = 0

for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - i - j <= k:
            count += 1

print(count)
# Original solution

k, s = list(map(int, input().split()))

if s==3*k:
    print((1))
else:
    ans=0
    for i in range(k+1):
        if i>s:
            break
        for j in range(k+1):
            if i+j>s:
                break
            for jj in range(k+1):
                if i+j+jj==s:
                    ans+=1
                elif i+j+jj>s:
                    break
    print(ans)

# Optimized solution
k, s = list(map(int, input().split()))

if s==3*k:
    print((1))
else:
    ans=0
    for i in range(k+1):
        if i>s:
            break
        for j in range(k+1):
            if i+j+k>=s and s-i-j>=0:
                ans+=1


    print(ans)
# Original solution
k, s = list(map(int, input().split()))

if s==3*k:
    print((1))
else:
    ans=0
    for i in range(k+1):
        if i>s:
            break
        for j in range(k+1):
            if i+j+k>=s and s-i-j>=0:
                ans+=1


    print(ans)

# Optimized solution
k, s = list(map(int, input().split()))

if s==3*k:
    print((1))
else:
    ans=0
    for i in range(k+1):
        if i>s:
            break
        for j in range(k+1):
            if i+j+k>=s and s-i-j>=0:
                ans+=1
            elif i+j>s:
                break

    print(ans)
# Original solution
k, s = list(map(int, input().split()))
ans = 0
for i in range(k+1):
  for j in range(k+1):
    for l in range(k+1):
      if (i + j + l) == s:
        ans += 1
        
print(ans)

# Optimized solution
k, s = list(map(int, input().split()))
ans = 0
for i in range(k+1):
  for j in range(k+1):
    z = (s - i - j)
    if 0<= z <= k:
      ans += 1
        
print(ans)
# Original solution
# Problem:
# Python  Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
intm1 = lambda x: int(x) - 1
intp1 = lambda x: int(x) + 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(intm1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(limitno, giventotal):
    result = 0
    for x in range(0, limitno+1):
        for y in range(0, limitno+1):
            z = giventotal - x - y
            if ( 0 <= z ) and (z <= limitno):
#                print("{} + {} + {} = {}".format(x,y,z,giventotal))
                result = intp1(result)
    return result


if __name__ == "__main__":
    K, S = MI()
    print("{}".format(solver(K, S)))


# Optimized solution
# Problem: https://atcoder.jp/contests/abc051/tasks/abc051_b
# Python  3rd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(maxNum, totalNum):
    result = 0
    for x in range(0,maxNum+1):
        for y in range(0,maxNum+1):
            z = totalNum - x - y
            if 0 <= z and z <= maxNum:
                result = result + 1
    return result


if __name__ == "__main__":
    K, S = MI()
    print("{}".format(solver(K, S)))
# Original solution
K,S = list(map(int,input().split()))
counter = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == S:
        counter += 1
print(counter)

# Optimized solution
K,S = list(map(int,input().split()))
counter = 0
for i in range(K+1):
  for j in range(K+1):
    k = S - i - j
    if(k >= 0) and (k <= K):
      counter += 1
print(counter)