**Problem**
A wedge with mass M rests on a frictionless horizontal tabletop. A block with mass m is placed on the wedge. There is no friction between the block and the wedge. The system is released from rest. Calculate the acceleration of the wedge.

*Included diagrams* **What I Tried**
I know that the answer ends up being:

$a_1=\frac{m_2gsinθcosθ}{m_1+m_2sin^2θ}\

$

but the system of equations I come up with does not give me that answer

$\displaystyle (1) -Nsinθ=m_1a_1$

$\displaystyle (2) Ncosθ-m_2g=m_2a_2sinθ$

$\displaystyle (3) Nsinθ=m_2(a_2cosθ+a_1)$

The answer for $\displaystyle a_1$ that I derive from that comes fairly close to the intended answer, but I don't see where I went wrong with my identification of forces. Thanks in advance for any help.

*Answer I get from those equations*
$a_1=\frac{m_2gsinθcosθ}{2m_1sin^2θ+m_2sin^2θ-m_1}\

$