fun main(args: Array<String>) {
  val (K, S) = readLine()!!.split(" ").map(String::toInt)
  var ans = 0

  (0..K).forEach { X -> 
    (0..K).forEach { Y ->
      if (0 <= S-X-Y && S-X-Y <= K) {
        ans = ans + 1
      }
    }
  }
  println(ans)
}