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).toArray
      y <- (0 to k).toArray
      z = s - x - y if 0 <= z && z <= k
    } yield (x,y,z)
  }.length

  println(res)
}
