First of all we identify all forces acting on the masses and the pulley. The force of gravity acts on the two masses, the tension pulls up. Now the pulley has two forces acting on it, the tensions and . Because the strings are massless, these tensions are the same in magnitude as the ones acting on the weights.
Now we draw free body diagrams for the pulley and the two masses.