n,m = map(int,input().split())
a = list(map(int,input().split()))
res = 0

for i in range(n):
    for j in range(i,n):

        if i == j:
            if a[i] % m == 0:
                res += 1
            continue
        else:
            if sum(a[i:j+1]) % m == 0:
                res += 1


print(res)
