object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val k, s = sc.nextInt()
  var ans = 0
  for {
    x <- 0 to k
    y <- 0 to k
    if 0 <= s - (x + y) && s - (x + y) <= k
  } {
    ans += 1
  }
  println(ans)
}
