Invariant imbedding and time-dependent diffuse reflection of a pencil of radiation by a finite inhomogeneous flat layer—I