You can’t perfectly mix & match 4x4 RS modules and STS M-Class modules in the standard RS Boat (RS4 or RS4P).
The STS M-Class module without its associated “Obelisk” power distribution panel is slightly less wide than a 4x4 RS module, so you’d end up with an ugly gap between the two.
But if you add the “Obelisk” power distribution, there’s not enough width left to fit a 4x4 RS module.
If you want to mix and match M-Class and 4x4 without gaps, you must use the extra-wide Shallow Boat XL (RS6). This will hold two M-Class plus Obelisk and two 4x4 modules.