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

