How to specify nonhomogeneous system with ModelingToolkit

Just make M a state and it will simplify out.