import heapq
import sys
input = sys.stdin.readline


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

    cnt = 0   
    for i in range(N):
        S = 0
        for j in range(i, N):
            S += A[j]
            if S%M == 0:
                cnt += 1
    
    print(cnt)


if __name__ == '__main__':
    main()