import java.util.Scanner

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

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

  val temp =
    for{
      x <- 0 to k
      y <- 0 to k
    }yield s - x - y

  val res = temp.count(z => 0 <= z && z <= k)

  println(res)


}
