fun main(arr: Array<String>) {
    val (k, s) = readLine()!!.split(" ").map { it.toInt() }
    val ans = getAns(0, s, k)
    println(ans)
}

fun getAns(idx:Int, remain:Int, k:Int):Int {
    if(idx >= 2) {
        if(remain < 0) {
            return 0
        }
        if(remain <= k) {
            return 1
        }
        return 0
    }
    var ans = 0
    for(i in (0..k)) {
        if(i > remain) {
            break
        }
        ans += getAns(idx+1, remain-i, k)
    }
    return ans
}