Draw the Force vectors that are applied to the objects in the system.
... both of them have mass, so both of them have weight (mg) pulling down.
The trolley's weight is perpendicular to the rope, and perpendicular to the ensuing displacement,
which makes it perpendicular to the eventual velocity and perp to the acceleration
- so that weight does not help nor hinder the acceleration (besides, the table's push upward cancels it).
But the hanging block weight is along the rope, so THAT one does cause acceleration
(sometimes only one component of the Force is along the acceleration, found by trig).
The acceleration term goes on the RIGHT side of the equation, as the effect.