#!/usr/bin/env python
# coding: utf-8
#


def main(n, m, a):
    retval = 0
    for i in range(1, n + 1):
        for j in range(0, n - i + 1):
            # print(i,j,a[j:j+i])
            if 0 == sum(a[j:j+i]) % m:
                retval += 1
    print(retval)
    
if __name__ == '__main__':
    try:
        n, m = list(map(int, input().strip().split(" ")))
        a = list(map(int, input().strip().split(" ")))
        main(n, m, a)
    except EOFError:
        pass
