inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
K = l[0] * 1
S = l[1] * 1 
cnt = 0
for (i=0; i<=K; i++) {
  for (j=0; j<=K; j++) {
      t = S - (i + j)
      if (t >= 0 && t <= K) {
          cnt++
      } 
  }
}
console.log(cnt)
