n, m = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
index = 0
while index < n:
  sum = 0
  i = index
  while i < n:
    sum += A[i]
    if sum % m == 0:
      ans += 1
    i+=1
  index += 1
print(ans)