First, use Newton's Second Law on each mass.
Solve the second equation for T.
[tex]T=W_2-m_2a[/tex]Combine the equations.
[tex]W_2-m_2a-W_1=m_1a_{}[/tex]But the weight force is mg.
[tex]m_2g-m_2a-m_1g=m_1a[/tex]Solve for a.
[tex]\begin{gathered} m_2g-m_1g=m_1a+m_2a \\ a(m_1+m_2)=m_2g-m_1g \\ a=\frac{m_2g-m_1g}{m_1+m_2} \end{gathered}[/tex]Let's say the masses are m_1 = 2 kg and m_2 = 5 kg.
[tex]\begin{gathered} a=\frac{5\cdot9.8-2\cdot9.8}{2+5} \\ a=\frac{49-19.6}{7} \\ a=\frac{29.4}{7} \\ a=4.2\cdot\frac{m}{s^2} \end{gathered}[/tex]Therefore, the acceleration of the system is 4.2 m/s^2.