On Differentiation of Functionals Containing the First Exit of a Diffusion Process from a Domain