#!/usr/bin/env python

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


class Counter:

    def __init__(self,):
        self.count = 0

    def set_a(self, a):
        self.a = a

    def my_add(self, s):
        t = s + self.a
        if t % m == 0:
            self.count += 1

        return t


counter = Counter()

temp_list = []
for a in an:
    counter.set_a(a)
    temp_list.append(0)

    temp_list = list(map(counter.my_add, temp_list))


print(counter.count)
