n,m=map(int,input().split())
w=[0]
if n<100:
    print(w[100])
l=[int(i) for i in input().split()]
d=[0]
for i in l:
    d.append(i+d[-1])
d.append(0)
ans=0
for i in range(n):
    for j in range(i+1,n+1):
        p=d[j]-d[i]
        if p%m==0: ans+=1
print(ans)