main :: IO ()
main = do
  [k, s] <- map read . words <$> getLine
  print $ solve k s

solve :: Int -> Int -> Int
solve k s = length [ (x, y) | x <- [0..k], y <- [0..k], 0 <= s - x - y && s - x - y <= k ]
