First, use Newton's Second Law on each mass.
Mass 1.
Mass 2.
Solve the second equation for T.
Combine the equations.
But the weight force is mg.
Solve for a.
Let's say the masses are m_1 = 2 kg and m_2 = 5 kg.
Therefore, the acceleration of the system is 4.2 m/s^2.