object Main extends App {
  var a = readLine.split(" ").map(_.toInt)
  var sum = 0
  for(i<-0 to a(0); j<-0 to a(0) if(i+j<=a(1))) {
    if(a(1)-i-j<=a(0)) {
      sum = sum +1
    }
  }
  println(sum)
}