# -*- coding: utf-8 -*-
# import numpy as np

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

pare_list = []
val_list = []

for i in range(N):
    tmp = 0
    for j in range(i,N):
        tmp += An[j]
        # pare_list.append((i,j))
        # for m in range(i,j+1):
        #     tmp += An[m]
        if tmp % M == 0:
            val_list.append(tmp)

print(len(val_list))
#
# count = 0
# for val in val_list:
#     if val % M == 0:
#         count += 1


# print(count)
# print(pare_list)
# print(val_list)
