object Main {
  def main(args: Array[String]) = {
    val ksList = readLine.split(" ").map(_.toInt)
    val res = (0 to ksList(0)).toList.map(x => (0 to ksList(0)).toList.map(y => if(0 <= (ksList(1)-x-y) && (ksList(1)-x-y) <= ksList(1)) 1 else 0 )).flatten.sum
    println(res)
  }
}