n,m = map(int,input().split())
a = list(map(int,input().split()))

from itertools import accumulate

b = [i%m for i in a]

def syakutori(k):
    #kが到達したい数値
    r,sum_li,res = 0,0,0
    for l in range(n):
        while r < n and sum_li%k != 0:
            sum_li += a[r]
            r += 1
        #ここら辺は問題に応じて書き換えること
        if r < l:
            r = l
            continue
        res += 1
        #↑ここまで書き換えゾーン
        sum_li -= a[l]
    return res
print(syakutori(m))