#!/usr/bin/env python

n, m = map(int, input().strip().split())
an = map(int, input().strip().split())

count = 0
temp_list = []
for a in an:
    temp_list.append(0)
    for i in range(len(temp_list)):
        temp_list[i] += a
        if temp_list[i] % m == 0:
            count += 1

print(count)
