from sys import stdin
from itertools import accumulate


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]
    sumA = [0] + list(accumulate(A))
    l = 1
    r = 1
    count = 0
    while True:
        if l == r == N:
            break
        if (sumA[r] - sumA[l - 1]) % M == 0:
            count += 1
        if r == N:
            l += 1
            r = l
        else:
            r += 1
    print(count)



if __name__ == '__main__':
    main()
