Modulo Sum - test case not passing

This is a question from number theory section. My code is not passing the third test case. Can anyone explain why?
https://ide.codingblocks.com/#/s/17017

question link - http://codeforces.com/contest/577/problem/B

Can you provide the Qn link as well ?

Updated with the question link

Heyy Aditi ! The approach that you are applying here is same as what you did in DIVISIBLE SUBARRAYS problem but that logic will not work here .You are finding for subarrays but here is the problem for subsequences that means you can have any elements from an array in this sequence . There is a difference between subarrays and subsequence .

1 Like

Can you please tell me the changes I should make to solve this question using pigeonhole principle?

I dont think pigeonhole principle will work here . First sort the array then use sliding window property to check wheather there exists subsequences having sum equal to k*m or not for some non-negative integer k.