import java.util.*

fun main(args: Array<String>) {
	val sc = Scanner(System.`in`)
	val k = sc.nextInt()
	val s = sc.nextInt()

	var cnt = 0
	for (x in 0..k) {
		for (y in 0..k) {
			val z = s - x - y
			if (z in 0..k) {
				cnt++
			}
		}
	}
	println(cnt)
}
