N, M = map(int, input().split())
A = list(map(int, input().split()))
for x in range(len(A)):
    A[x] = A[x] % M
ans = 0
  

for x in range(N):
    temp = 0
    for y in range(x,N):
        if x == y:
            if A[x] % M == 0:
                ans += 1
                
        else:
            for z in range(x,y):
                temp += A[z]
            if temp % M == 0:
                ans += 1
            

print(ans)
