You need to set up an equation of motion for block one and block two separately. You can also use the fact that the tension in the rope attached to block 1 is equal to the tension in the rope attached to block 2. Then you can solve for m1.
Find all the forces acting on block 1 and set that equal to m1a. Then find all the forces acting on block two and set that equal to m2a. Then by solving for T, you can get the equation down to one variable and solve for m1.