func :: Int -> Int -> Int
func k s = sum 
  $ map (\x -> 1)
  $ filter (\x -> x >= 0 && x <= k)
  [s - (a + b) | a <- [0..k], b <- [0..k]]

main = do
  line <- getLine
  let
    [k,s] = map read $ words line :: [Int]
    ans = func k s
  putStrLn $ show ans
