from itertools import accumulate as ac
n,a=map(int,input().split())
o=[0]+list(map(int,input().split()))
m=list(ac(o))

q=sum(1 for l in range(1,n+1) for r in range(l,n+1) if (m[r]-m[l-1])%a==0)
print(q)