If \( y = y(x) \) and \[ \left( \frac{2+\sin x}{y+1} \right)\frac{dy}{dx} = -\cos x, \] with the initial condition \( y(0) = 1 \), then find \[ y\left(\frac{\pi}{2}\right) = \, ? \]