Here it is:
The movement of the three masses is vertical.
The length of the cord does not change.
So, when the mass M moves vertically an amount dym (downwards), in the same time the mass K moves vertically (upwards) an amount dyk such that the portion of the cord between the pulley and the new position of K is dym shorter.
Draw the positions at two times dt apart, such that the angle between the 1st and the 2dn position of the cord very small.
Draw a normal to the cord at the 1st position passing by K at the 2nd position. It is also normal to the cord at the 2dn one as dt->0.
Observe that dym=dyk*cos(X) [regardless of signs].
The speed of M is u=dym/dt; the speed of K is dyk/dt = u/cos(X).
Regards
Z