Hi, this algorithm throws an error when value of M=1. It works fine at M=0 and M=2. Any specific reasons for not working at M=1?