package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
		matrix[0][0] = a[0] % m
	}
	count := 0
	for i := 0; i < n; i++ {
		for j := i; j < n; j++ {
			if (i == 0) && (j != 0) {
				matrix[i][j] = (matrix[i][j-1] + a[j]) % m
			}
			if i != 0 {
				matrix[i][j] = (matrix[i-1][j] - a[i-1]) % m
			}

			if matrix[i][j] == 0 {
				count++
			}
		}
	}
	fmt.Println(count)
}
