import java.util.Scanner

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

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

  val res =
    (0 to k).foldLeft(0) { (c1, x) =>
      (0 to k).foldLeft(c1) { (c2, y) =>
        val z = s - x - y
        c2 + (if (0 <= z && z <= k) 1 else 0)
      }
    }

  println(res)
}
