program main
  implicit none
  
  integer :: i,j,k,s,l,c=0
  
  read(*,*)k,s
  do i = 0, k
    do j = 0, k
      l = s - i - j
      if ((0<=l) .and. (l<=k)) then
        c = c + 1
      end if
    end do
  end do
  write(*,*)c
end program main