fun main(args: Array<String>) = ABC051B.main()

object ABC051B {
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }

    fun main() {
        val (K, S) = readInts()

        var cnt = 0
        (0..K).forEach { x ->
            (0..K).forEach { y ->
                val z = S - x - y
                if (0 <= z && z <= K) cnt++
            }
        }

        println(cnt)
    }
}