If \((2+\sin x) \frac{\mathrm{d} y}{\mathrm{~d} x}+(y+1) \cos x=0\) and \(y(0)=1\) then \(y\left(\frac{\pi}{2}\right)\) is equal to