import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]


def main():
    n, m = na()
    a = na()

    c = 0
    for l in range(n):
        v = 0
        for r in range(l, n):
            v += a[r]
            if v % m == 0:
                c += 1

    print(c)
                
main()
