(* O(k^2) *)
Scanf.scanf "%d %d" @@ fun k s ->
  let ans = ref 0 in
  for x = 0 to k do
    for y = 0 to k do
      let z = s - x - y in
      if 0 <= z && z <= k then incr ans
    done
  done;
  Printf.printf "%d\n" !ans