The attached picture is a snapshot of lecture $8$ from the popular series of lectures given by Professor Walter Lewin at MIT. The subject matter is friction.
Assume we have known masses $m_1,m_2$ arranged as in the picture. Given that the mass $m_2$ is accelerating vertically downwards, so that $m_1$ is accelerating up the hill, with some acceleration $a$. Assume that the kinetic coefficient of friction of the hill is known, say, $\mu_K$. The problem is to calculate $a$. Lewin's solution is as follows. By Newton's second law, the component of the force acting on $m_1$ in the $x$-direction (see picture) must then satisfy the equation: $$T-m_1g\sin\alpha-\mu_Km_1g\cos\alpha = m_1a$$ This is an equation in two unknowns, the acceleration $a$, and the tension $T$ in the string. Next, Lewin argues that since $m_2$ is also accelerating in the same acceleration $a$, we must have a second equation, for the component of the force acting on $m_2$ in the vertical direction: $$m_2g-T=m_2a$$ and now it is a trivial matter to solve two equations in two unknowns. One may follow his argument in the video Lewin's lecture on friction, starting at time $23:10$.
My question is this: Why is it possible to assume that the masses $m_1,m_2$ are accelerating in the same magnitude? How is it possible to apply Newton's second law to two different masses, each moving in a completely different direction, with the same magnitude of acceleration? A naive answer could be: "well, Lewin said that the whole system is accelerating with magnitude $a$, so both masses, being part of the same system, must accelerate in the same magnitude". But I cannot convince myself with this answer, because the masses are not moving in the same direction, so it makes no sense to speak of a single acceleration common to both of them, or does it?