Implemented solution for CodeEval's N Mod M challenge
https://www.codeeval.com/open_challenges/62/