Finally! The problem was that from the very start I was inverting the polarity of m1a2. I kept writing down T - m2g = -m2a2. I did that because I had it in my head that a2 was negative, which it is, but only after solving for a2. By assigning it as negative from the start, I was in fact just...