#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cctype>
#include<vector>
#include<iostream>
#define INF 0x7fffffff
using namespace std;
int a[100010],premod[100010];
int main(){
    int n,k,sum=0;cin>>n>>k;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        premod[i]=premod[i-1]+a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n-i+1;j++){
            if((premod[i+j-1]-premod[i-1])%k==j){
                sum++;//printf("(%d %d)\n",i,i+j-1);
            }
        }
    }
    printf("%d\n",sum);
}
