#encoding utf-8

n, m = map(int, input().split())
a = [int(i) for i in input().split()]

count = 0
for i in range(n):
    candy = a[i]
    if candy % m == 0:
        count += 1
    for rest in range(1,n-i):
        candy += a[i+rest]
        if candy % m == 0:
            count += 1

print(count)
