package main

import "fmt"

func main() {
	var i, t int64
	var N, M int64
	fmt.Scan(&N)
	fmt.Scan(&M)

	A := make([]int64, N)
	for i = 0; i < N; i++ {
		fmt.Scan(&A[i])
	}

	result := 0

	for i = 0; i < N; i++ {
		t = 0
		for j := i; j < N; j++ {
			t = (t + A[j]) % M
			if t == 0 {
				result++
			}
		}
	}

	fmt.Println(result)
}
