N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
count = 0

for i in range(N):
    total = A[i]
    if A[i] == M:
        count += 1

    for l in range(i+1, N):
        total += A[l]
        if total % M == 0:
            count += 1
print(count)
