# cook your dish here
import itertools
n,m=list(map(int,input().split()))
L=list(map(int,input().split()))
count=0
for i in range(0,len(L)):
    for j in range(1,len(L)-i+1):
        #print(L[i:i+j] )
        s=sum(L[i:i+j] )
        if s%m==0:
            count+=1
print(count)        