N,M = (int(i) for i in input().split())
a = input()
s = a.split()
A = []
for i in range(N):
    A.append(int(s[i]))

count = 0
total = 0

for r in range(N):
    for j in range(int(r+1)):
        l = j
        total = 0
        while l <= r:
            total += A[l]
            if l == r:
                if total % M == 0:
                    count += 1
                    break
                else:
                    break
            else:
                l += 1
print(count)