A block of mass M M\,M is placed on a frictionless inclined plane at an angle θ \theta\,θ to the horizontal. It is connected by a light, inextensible string passing over a frictionless pulley to a hanging object of weight WWW, as shown in the diagram.

When released from rest, the hanging object accelerates downwards. The acceleration of free fall is ggg.
Which of the following is the correct expression for the magnitude of the acceleration a a\,a of the system?
a=W−MgcosθM+Wga = \frac{W - Mg \cos\theta}{M + \frac{W}{g}}a=M+gWW−Mgcosθ
a=W−MgsinθM+Wga = \frac{W - Mg \sin\theta}{M + \frac{W}{g}}a=M+gWW−Mgsinθ
a=W−MgsinθMa = \frac{W - Mg \sin\theta}{M}a=MW−Mgsinθ
a=W+MgsinθM+Wga = \frac{W + Mg \sin\theta}{M + \frac{W}{g}}a=M+gWW+Mgsinθ