#include <iostream>
#include <cstdio>
using namespace std;
long long int a[200005] = { 0 };
int main() {
	long long int n = 0, k = 0, x = 0,i=0,j=0,last=0,first=0,sum=0,cnt=0;
	scanf("%I64d %I64d", &n, &k);
	for (i = 0;i < n;i++) {
		scanf("%I64d", &a[i]);
	}
	for (i = 0;i < n;i++) {
		first = i;sum = 0;
		for (j = i;j < n;j++) {
			sum += a[j];last = j;
			if (sum % k == last - first + 1) {
				cnt++;
			}
		}
	}
	printf("%I64d\n", cnt);
	return 0;
}