if __name__ == '__main__':
    N = list(map(int, input().split()))
    l = list(map(int, input().split()))

    count = 0

    for i in range(len(l)):
        for j in range(i, len(l)):
            if sum(l[i:j+1]) % N[1] == 0:
                count += 1

    print(count)
