Skip to main content

~/algor $ cat contests/round-6/H

H. Sums divisible by k

Problem H ICPC rules 1000 ms 128 MB

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.