Three forces acting on the m1 are the force of gravity normal reaction by the inclined plane and the tension in the string. The free body diagram for this mass is shown in figure.

Taking the x-axis along incline and y-axis perpendicular it, we have for the x and y components.
x component m1 ax = T – m1g sinθ (I)
y component 0 = N – m1g cos θ (II)
The only forces acting on m2 are the force of gravity and tension in the string. Free body diagram for mass m2 is shown in the figure. Taking vertically downward to be the positive y direction we get

m2 a = m2 g – T (III)
(Note : If we choose positive y to be vertically upwards then the acceleration of m2 will be opposite of m1)
Solving I and III

If m2 < m1 sin θ then m1 will slide downward.