package main

import "fmt"

func main() {
        var n int
        var m uint64
        fmt.Scan(&n, &m)
        a := make([]uint64, n)
        for i := range a {
                fmt.Scan(&a[i])
        }

        dp := make([][]uint64, n)
        for l := range dp {
                dp[l] = make([]uint64, n)
        }
        dp[0][0] = a[0]
        for r := 1; r < n; r++ {
                dp[0][r] = dp[0][r-1] + a[r]
        }
        for l := 1; l < n; l++ {
                for r := l; r < n; r++ {
                        dp[l][r] = dp[l-1][r] - a[l-1]
                }
        }

        var cnt uint64
        for l := 0; l < n; l++ {
                for r := l; r < n; r++ {
                        if dp[l][r]%m == 0 {
                                cnt++
                        }
                }
        }
        fmt.Println(cnt)
}