import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val k = sc.nextInt
  val s = sc.nextInt

  val res = {
    for {
      x <- 0 to k
      y <- 0 to k
      z = s - x - y if 0 <= z && z <= k
    } yield (x,y,z)
  }.size

  println(res)
}
