n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
r = []
ret = 0
for i in range(len(a)):
  for j in range(len(r)):
    r[j] += a[i]
    if r[j] % m == 0:
      ret += 1
  if a[i] % m == 0:
    ret += 1
  r.append(a[i])
print(ret)