def f(As, M):
    prev = None
    c = 0

    for i, A in enumerate(As):
        A %= M
        if i == 0:
            prev = [A]
            if A == 0:
                c += 1
            continue

        ccc = [A]
        for p in prev:
            ccc.append((p + A) % M)
        c += ccc.count(0)
        prev = ccc
    return c


def main():
    N, M = [int(a) for a in input().split()]
    As = [int(a) for a in input().split()]
    print(f(As, M))


if __name__ == '__main__':
    main()
