n,m=map(int,input().split())
l=list(map(int,input().split()))
ls=[0]
tmp=0
for i in l:
    tmp+=i
    ls.append(tmp)
ans=0
print(ls)
for i in range(n+1):
    for j in range(i+1,n+1):
        if (ls[j]-ls[i])%m==0:
            ans+=1
print(ans)