number_box,number_person = list(map(int,input().split()))
number_snack = list(map(int,input().split()))

ans = 0
for i in range(number_box):
    for j in range(i+1):
        if  sum(number_snack[j:i+1])%number_person == 0:
            ans += 1
            
print(ans)