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
import sys

n,k=map(int,sys.stdin.readline().split())
lists=list(map(int,sys.stdin.readline().split()))
answer=0
for i in range(n-k) :
	if abs(lists[i]-lists[i+k])%k==0 or (lists[i]+lists[i+k])%k==0 :
		answer+=1
print answer