Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …
Problems
#856

~/algor $ cat problems/7hy64HQWGURY

Sums divisible by k

Medium 1000 ms 128 MB 45%
Share

An array of integers and a positive integer are given. For how many pairs () is the sum below divisible by ?

The array 1, 2, 3, 4, −1: the part 2, 3, 4 sums to 9, which is divisible by k = 3

Input

The first line contains two positive integers: and . The second line contains integers: .

Output

One integer — the number of pairs.

Note



Examples

Input #1
5 3
1 2 3 4 -1
Output #1
7
Input #2
4 5
-1 -4 5 0
Output #2
6

Sign in to submit a solution

Signing up is free and takes a minute.