import numpy as np
import math

N, M = map(int, input().split())

A = list(map(int, input().split()))

# 1 <= N <= 10^5
# 2 <= M <= 10^9
# 1 <= A <= 10^9

dp = np.zeros(N+1, dtype=int)

dp[N] = 0

for i in reversed(range(N)):
    # N-1 -> 0
    total = 0
    for j in range(i, N):
        total += A[j]
        if total % M == 0:
            dp[i] = 1 + dp[j+1]
            break

# print(dp)
print(sum(dp))
