main = do
    [k_, s_] <- return . map read . words =<< getLine
    let pairs = [(x,y) | x <- [0..k_], y <- [0..k_]]
	check (x,y) =	let z = s_ - x - y
			in 0 <= z && z <= k_
    print . length $ filter check pairs