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