Answer : $(M+m)g\tan\theta$
In this case M and m are moving with the same acceleration a. Note that a is along x-direction only
For M and m :
$F-N_2\sin \theta=Ma$--------(1)
$mg-N_2\cos\theta=0$$\Rightarrow N_2=\large\frac{mg}{\cos\theta}$------(2)
$N_2\sin \theta=ma$------(3)
From (2) and (3),
$a=g\tan\theta$
Substitute (3) into (1) obtains
$F = (M + m) a $
$\;\;\;= (M + m)g \tan\theta$