n, m = map(int, input().split())
a = list(map(int, input().split()))
dp = [[-1 for _ in range(n)] for _ in range(n)]
count = 0
for i in range(n):
    dp[i][i] = a[i] % m
    if dp[i][i] == 0:
        count += 1
for i in range(n):
    for j in range(i+1,n):
        dp[i][j] = (dp[i][j-1] + a[j]) % m
        if dp[i][j] == 0:
            count += 1
print(count)