n, m = map(int, input().split())
a = list(map(lambda x: x % m, map(int, input().split())))

s = 0
l = []
for i in range(n):
  if a[i] == 0:
    s += 1
  l.append(a[i])
  
for i in range(n):
  for j in range(i+1, n):
    l[i] = (l[i] + l[j]) % m
    if l[i] == 0:
      s += 1

print(s)