Solution for N Mod M.