
n,m=map(int, input().split())  
a=list(map(int, input().split()))

for i in range(n):
    a[i]=a[i]%m

count=0
cnt=0

for i in range(n):
    for j in range(i,n):
        cnt=(cnt+a[j])%m
        if cnt==0:
            count+=1
            
    cnt=0
    

print(count)




