N, M = map(int, input().split())
A_s = list(map(int,input().split()))


x = 0
for l in range(N):
  for r in range(N-l+1):
    hoge = float(sum(A_s[l:l+r+1]) / M)
    if hoge.is_integer():
      x += 1
      
print(x)