
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]
    for i in range(N):
        for j in range(N-i):
            if mod_list[i+j] % M == 0:
                count += 1

    print(count)



if __name__ == "__main__":
    main()