You can continue merrily along with some algebraic manipulation until you get:
m(p1+...+pn)(m-n) = n(q1+...+qm)(m-n) ,
which seems quite simple really. So either m=n (the sizes of the sets are equal), which makes both sides 0 and hence satisfies the equation, or m is not equal to n, which means we can get the equation,
(p1+...+pn)/n = (q1+...+qm)/m
That is, the means of each set are equal.
Why go into detail for so much for results that can quite clearly be figured out with a little intuition you might ask? Well, I didn't think to use intuition, thus I started to write it down. And there was no way I was gonna delete it to do a two-liner after all that!