Hi Bss,
Firstly - swopping a M40 out for a M10 is farming backwards on the electronics side.
The M10 runs a different fuel injection system to the M40's system. That may be part of your problem.
First you need to identify where the spark starts and stops. The spark is generated by the coil, if your coil is faulty, it wont spark. Check for spark on the coil.
Next thing to do, is check your wiring to your plugs and distributor cap. Check for spark on your plug leads.
next step is to check if the spark is coming through to the plugs.
Check those and let us know.