Your formula introduces an increaing probability of "stay the same on each step" as M, the number of walks, grows. Is that your intent? I doubt it. Here are plots of what happ[ens with your code when N=100, and M=1, M=2, and M=5. Notice the increase in the probability of making a "step" of 0, and M grows.
You can fix it by modifying (simplifying) your cumsum() statement.