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