def main():
    N, M = map(int, input().split())
    num_list = list(map(int, input().split()))
    count = 0
    mod_list = [i % M for i in num_list]
    print(mod_list)
    for i in range(N):
        num = 0
        for j in range(N-i):
            num += mod_list[i+j]
            if num % M == 0:
                count += 1

    print(count)



if __name__ == "__main__":
    main()