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

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