Let's say the mass of the pendulum is $m$. The forces acting on it are the tension in the wire and gravity. We know that it's stationary with respect to the wagon, so it means that it has the same acceleration $\vec a$. Writing Newton's second law, we get $$m\vec a=\vec T+m\vec g$$Let's decompose this into vertical and horizontal direction. $\vec T$ makes an angle $\beta$ with respect to the vertical, and $\vec a$ makes angle $\alpha$ with respect to the horizontal. Let's choose the positive direction in the horizontal plane to the left. Then in the vertical direction you have $$T\cos\beta=mg+ma\sin\alpha$$ and in the horizontal direction you have $$T\sin\beta=ma\cos\alpha$$ Dividing the two will get rid of the tension $T$: $$\frac{\sin\beta}{\cos\beta}=\frac{ma\cos\alpha}{mg+ma\sin\alpha}$$ or:$$\tan\beta=\frac{a\cos\alpha}{g+a\sin\alpha}$$ Now all you need to do is write the forces on the wagon, to get $a$.