# coding : utf-8

row= [int(i) for i in input().split(' ')]
N = int(row[0])
M = int(row[1])
A = [int(i) for i in  input().split()]

# print(N)
# print(M)
# print(A)

cnt = 0

for l in range(1,N+1):
    for r in range(l,N+1):
        A_sum=0
        for i in range(l,r+1):
            A_sum += A[i-1]
        if A_sum % M == 0:
            cnt += 1

print(cnt)
