All the surfaces shown in figure are assumed to be frictionless. The block of mass m slides on the prism of mass M which in turn slides backward on the horizontal surface. Find the acceleration of the smaller block with respect to the prism.

Well I found out acceleration of both the blocks and then considered a pseudo force on the smaller block since we have to find acceleration with respect to the accelerating prism. I got two accelerations acting on smaller block m making an angle theta and then I took resultant of the two accelerations but ended up with the wrong answer, someone please help!