ans' k n =
  if n < 0
  then 0
  else
    if 2 * k < n
    then 0
    else
      if k >= n
      then n+1
      else (2 * k) - n + 1

ans :: Integer -> Integer -> Integer
ans k s = 
  let xs = [0..k]
      o = sum $ map (\i -> ans' k (s-i) ) xs
  in
    o

main = do
  c <- getLine
  let (k:s:_) = map read $ words c :: [Integer]
      o = ans k s
  print o
 
