fun main(args:Array<String>) {
    val l1 = readLine()!!.trim().split(' ').map(String::toInt)
    val l2 = readLine()!!.trim().split(' ').map(String::toInt)
    val n = l1[0]
    val m = l1[1]
    var result = 0
    for(i in 0..n-1){
        var calc = 0
        for(ii in i..n-1){
            calc = (calc+l2[ii])%m
            if( calc == 0 ) result++
        }
    }
    println(result)
}