import java.util.Scanner

fun main(args:Array<String>){
    val scanner=Scanner(System.`in`)

    val n=scanner.nextInt()
    val m=scanner.nextInt()

    var a=IntArray(n)
    var sum:Long
    var count=0

    for (i in 0 until n){
        a[i]=scanner.nextInt()
    }

    for (l in 0 until n){
        for (r in l until n){
            sum=0
            for (k in l..r){
                sum+=a[k]
            }
            if (sum%m==0L) count++
        }
    }

    println(count)
}