n,m = map(int,input().split())
a = list(map(int,input().split()))
print(a)
count = 0
for i in range (n):
    for j in range(n):
        if sum(a[i:j+1])%m == 0 and sum(a[i:j+1]) != 0:
            count +=1
print(count)