solve :: Int -> Int -> [(Int, Int, Int)]
solve k s = do x <- [0..k]
               y <- [0..k]
               let z = s-x-y
               if z >= 0 then return (x, y, z) else []

main = do
  [k, s] <- map read . words <$> getLine
  putStrLn $ show $ length $ solve k s
