import Control.Applicative
import Data.List
import System.IO

main = do
    ss <- (map read . words) <$> getLine :: IO [Int]
    let (k,s) = (ss !! 0 , ss !! 1)
    print $ length [0| x <- [0..k],y <- [0..k],z <- [0..k], x + y + z == s]
