def main():
    n, m = map(int, input().split())
    a = [int(x) for x in input().split()]

    count = 0
    for i in range(0, n):
        for j in range(i, n):
            if sum(a[i:j+1]) % m == 0:
                count = count + 1

    print(count)


if __name__ == '__main__':
    main()
