I’ll start off with the easy bit.
The strings and pulleys have the usual conditions, so the string from the 1kg load to Mass No1 has uniform tension throughout.
The string from Mass No2 to Mass No 1 likewise has uniform tension M2kg
The diagram above should help
Next is to resolve forces horizontally at X to Find Mass No2
Remember, the system is at rest and is statically stable. So the horizontal forces at X must balance.
I’m pretty sure I remember doing this sort of thing in Applied Maths for A-Levels but i'll give it a day or so before setting out my version of events............