fun main(args: Array<String>) {
    val (k,s)= readLine()!!.split(" ").map { it.toInt() }
    var count=0

    for(a in 0..k)for(b in 0..k) {
        val c=s-a-b
        if(c in 0..k) count++
    }
    println(count)
}