n,m = (int(x) for x in input().split())
a = list(map(int, input().split()))
sum = [0]*(n+1)

for i in range(1,n+1):
  sum[i] = sum[i-1] + a[i-1]

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