CSES Subarray Divisibility Help needed

For above solution I don’t understand why we do M[0] = 1 initially?

This is because initial sum is 0 and we need to add initial sum to the count.

1 Like

Yes, thank you!