import scala.io.StdIn
object Main extends App {
  val List(k, s) = StdIn.readLine().split(" ").map(_.toInt).toList
  val xyzs = for {
    x <- 0 to k
    y <- 0 to k
    z = s - x - y
    if (0 <= z && z <= k)
  } yield (x, y, z)
  println(xyzs.length)
}
