# 累積和と包除原理でいけるんですか？
# [(0, 8, 136), (0, 12, 323), (1, 10, 204), (2, 2, 34), (5, 7, 119), (6, 8, 85), (6, 12, 272), (10, 11, 187)]
# [(0, 8, 136), (0, 12, 323), (1, 2, 34), (4, 7, 119), (5, 8, 85), (5, 12, 272), (9, 9, 136), (9, 11, 187)]

n, m = map(int, input().split())
arr = list(map(int, input().split()))
ruiseki_arr = [0] * n
ruiseki_arr[0] = arr[0]
for i in range(1, n):
    ruiseki_arr[i] = ruiseki_arr[i - 1] + arr[i]
ans = 0
ans_arr = []
for i in range(n):
    for j in range(i, n):
        if i > 0:
            target = ruiseki_arr[j] - ruiseki_arr[i - 1]
        elif i == j:
            target = arr[i]
        else:
            target = ruiseki_arr[j]
        if target % m == 0:
            # print("----yay?----")
            # print("i, j = {}, {}, target ={}".format(i, j, target))
            # ans_arr.append((i, j, target))
            ans += 1
print(ans)