Xenny had N boxes with an integer printed on each of the boxes.

He wanted to find out how many distinct pairs of boxes that were at distance k from each other, had an absolute value of difference or sum that was a multiple of k.

Help him in this task.

(Note: Consider two indices i1 and i2. Pairs (i1, i2) and (i2, i1) are not considered to be distinct)

Input Format:

First line contains 2 space-separated integers - N and k.
Second line contains N space-separated integers.

Output Format:

Output a single line, denoting the number of required pairs.

Constraints:

2 ≤ N ≤ 10^6

1 ≤ k ≤ 1000

-1000000 ≤ Integer on box ≤ 1000000

SAMPLE INPUT
10 1
1 2 3 4 5 6 7 8 9 10

SAMPLE OUTPUT
9
s=map(int,raw_input().split())
n,k=s
N=map(int,raw_input().split())
d={}
for i in xrange(0,n):
    if (i+k)<n:
        if (N[i]+N[i+k])%k==0 or abs(N[i]-N[i+k])%k==0:
            if (i,i+k) not in d and (i+k,i) not in d:
                d[(i,i+k)]=1
    else:
        if (i-k)>=0:
            if (N[i]+N[i-k])%k==0 or abs(N[i]-N[i-k])%k==0:
             if (i,i-k) not in d and (i-k,i) not in d:
                d[(i,i-k)]=1
print len(d)