n,m=map(int,input().split())
a=list(map(int,input().split()))
a1=[0]*n
for i in range(n):
    a1[i]+=a[i]
    if i==n-1:break
    else:a1[i+1]+=a1[i]
c=0
for l in range(n):
    r=l
    for ri in range(n-r):
        if (a1[r+ri]-a1[l])%m==0:
            c+=1
        else:break
print(c)