from itertools import accumulate
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, M = map(int, input().split())
    A = map(int, input().split())

    snacks = [0] + list(accumulate(A))
    cnt = 0
    for i in range(N + 1):
        for j in range(i + 1, N + 1):
            if not (snacks[j] - snacks[i]) % M:
                cnt += 1
    print(cnt)

main()
