fun main() {
    val (k, s) = nextIntList()
    val ans = solve(k, s)
    println(ans)
}


fun solve(k: Int, s: Int): Int {
    return (0..k).flatMap { first ->
        (0..k).filter { second ->
            s - first - second in 0..k
        }
    }.count()
}

fun nextInt(): Int {
    return readLine()!!.toInt()
}

fun nextIntList(): List<Int> {
    return readLine()!!.split(" ").map { it.toInt() }
}