import algorithm, sequtils, strutils, math


let l = map(readLine(stdin).split(), parseInt)
let a = map(readLine(stdin).split(), parseInt)

var cnt: int64
for i in countup(0, a.len-1):
  for j in countup(i, a.len-1):
    if sum(a[i..j]) mod l[1] == 0:
      cnt += 1

echo cnt
