def solution():
    m, n = map(int, input().split())

    arr = list(map(int, input().split()))
    ans = 0
    for i in range(m - 1):
        for j in range(i + 1, m + 1):
            if sum(arr[i:j]) % n == 0:
                ans += 1
    if arr[-1] % n == 0:
        ans += 1
    return ans


print(solution())
