import Control.Monad
import Control.Applicative

main :: IO ()
main = do
  [k,s] <- map read . words <$> getLine
  let ans = [s-a-b | a <- [0..k], b <- [0..k], 0 <= (s - a - b) && (s - a - b) <= k]
  print $ length ans
