n, m = map(int, input().split())
l = list(map(int, input().split()))
sum = [0]*(n+1)
ans = 0
for i in range(1, n+1):
  sum[i] = sum[i-1] + l[i-1] 

for i in range(1, n+1):

  for j in range(0, i):
    t = sum[i] - sum[j]
    if t % m == 0:
      ans += 1

print(ans)