Divisible subarray problem

I implement the brute force sol of this problem O(n^2) .
But I not able to understand the O(n) solution which is implement with the use of pigeon hole principle.
I know till the cumulative sum with mod N then after I am not able to understand the approach how we get closer to the solution. I watch the video 3 times but not able to understand . I am feeling very demotived… so could you explain me in brief.