import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

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