Im not sure but i think i KVM switch will enable you to use 1 monitor and keyboard on both comps, but i aint sure how you are going to enable multiple displays from both comps maybe a KVM will allow you to that too
I have a KVM from Starview (SV421DD) that does what you are asking. Big problem with it, though, is that you are forced to use a PS/2 keyboard and mouse. There is probably a product from that which supports USB.
Any plain KVM will do what you want since you want M2 to be connected to PC2 permanently.
Just connect the PCs, M1, keyboard and mouse to the KVM.
Oh yeah! You're right Nod - that part didn't fully process for me