n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in a:
  b.append(i%m)
combi=0
for i in range(len(b)):
  sum=0
  for j in range(len(b)-i):
    sum=(sum+b[i+j])%m
    if sum==0:
      combi+=1
print(combi)