Need Help (what did i do wrong)

An object with mass m1 = 5.00 kg, rests on a frictionless horizontal table and is connected to a cable that passes over a pulley and is then fastened to a hanging object with mass m2 = 9.0 kg, as shown in Figure P4.30. Find the acceleration of each object and the tension in the cable.

mass m1 m/s^2
mass m2 m/s^2
tension N

Okay, I did a similar problem to this but the only difference was m1 and m2 location and an incline. I used this formula which I believe is correct to use here but end up with the wrong answer.

T = M_2g + M_2a and M_1g - T = M_1a i plug in T and solve for a which gives 2.8 which is incorrect then i thought i made a mistake in my equation and tried again to get 5.8 which was also incorrect.

Staff: Mentor

Don't use "a formula"; use Newton's 2nd law to create your own formulas. Start by identifying the forces acting on each mass in the direction of motion. (Also use a consistent sign convention, so you can use the same "a" to represent the acceleration of both masses.)