Sub-Array sum divisible by K
##### Submissions: 2643   Accuracy: 31.44%   Difficulty: Easy   Marks: 2

You are given an array A of N positive and/or negative integers and a value K. The task is to find the count of all sub-arrays whose sum is divisible by K.

Input:
The first line of input contains an integer T denoting the number of test cases. Each test case contains two integers N and K where N denotes the number of elements in the array A. Next line contains space separated N elements in the array A.

Output:
Print an integer which denoted the number of such sub-arrays.

Constraints:
1 <= T <= 100
1 <= N <= 106
-106 <= Ai <= 106
1 <= K <= 106

Example:
Input:

3

3 2 1
6 2
2 2 2 2 2 2
Output:
1
21

Explanation:
Testcase 1:
Only 1 is needed to move to top which makes the array sorted.

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shashwat Jain
Author: shashwat jain

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.