n = list(map(int,input().split()))
a = list(map(int,input().split()))
res = 0
for i in range(n[0]):
  for j in range(i,n[0]):
    SUM = 0
    for k in range(i,j+1):
      SUM += a[k]
      
    if SUM % n[1] == 0:
      res += 1
print(res)