N, M = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(0, N):
    for j in range(i, N):
        if i == j:
            if a[i]%M == 0:
                ans += 1
        elif sum(a[i:j+1])%M == 0:
            ans += 1
        else:
            pass
print(ans)