main :: IO ()
main = do
  [k,s] <- map read . words <$> getLine :: IO [Int]
  let z_xpy = zip [0..k] [xpy | z <- [0..k], let xpy = s-z]
  let yz = [(y, z) | y <- [0..k], (z, xpy) <- z_xpy, xpy - y >= 0]
  let xs = [x | x <- [0..k], (y, z) <- yz, x + y + z == s]
  print $ length xs

