#K94302. Special Subarrays
Special Subarrays
Special Subarrays
We are given an array of n integers and an integer k. A subarray is called special if the sum of its elements is divisible by k. In other words, if we denote a subarray by A[i...j], it is special if (\sum_{l=i}^{j} A[l] \equiv 0 \pmod{k}).
Your task is to count the number of special subarrays in the array.
inputFormat
The input is read from standard input (stdin). The first line contains two integers n and k, where n is the number of elements in the array and k is the divisor. The second line contains n space-separated integers representing the array.
outputFormat
Output a single integer to standard output (stdout), which is the number of special subarrays whose sum is divisible by k.## sample
5 5
5 1 2 3 4
4
</p>