n, m = map(int, input().split())
# n = boxの数、 m = 人数
A = input().split()

ans = 0
for i  in range(n):
  
  sums = []
  sums = []
  for j in A[i:n]:
    sums.append(int(j))
    if sum(sums) % m == 0:
      ans += 1

print(ans)