give integer array nums integer k p return number distinct subarray k element divisible pTwo array nums1 nums2 say distinct ifthey different length orthere exist index nums1i nums2iA subarray define nonempty contiguous sequence element array Example 1input num 23322 k 2 p 2output 11explanationthe element indice 0 3 4 divisible p 2the 11 distinct subarray k 2 element divisible 2 are2 23 233 2332 3 33 332 3322 32 322 22note subarray 2 3 occur num count oncethe subarray 23322 count 3 element divisible 2example 2input num 1234 k 4 p 1Output 10explanationall element num divisible p 1Also subarray num 4 element divisible 1since subarray distinct total number subarray satisfy constraint 10 constraints1 numslength 2001 numsi p 2001 k numslength Follow upcan solve problem on2 time complexity