main :: IO ()
main = do
  [k, s] <- map (read :: String -> Int) .words <$> getLine
  let ans = [(x,y,s-x-y) | x <- [max 0 (s - 2 * k)..k]
                     , y <- [max 0 (s - 2 * k)..min k (s-x)]
                     , s - x - y >= 0 && k >= s - x- y]
  print $ length ans
