use std::io::*;
use std::str::*;

fn main() {
    let n: usize = read_one();
    let m: i64 = read_one();
    let a: Vec<i64> = read_vec();

    let mut sum: Vec<i64> = a.iter().scan(0, |state, &x| {*state = *state + x; Some(*state)}).collect();
    sum.insert(0, 0);

    let mut ans = 0;

    for r in 0..n {
        for l in 0..r+1 {
            if (sum[r+1] - sum[l]) % m == 0 {
                ans += 1;
            }
        }
    }


    println!("{}", ans);
}

fn read_one<T: std::str::FromStr>() -> T {
    let mut s = stdin().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}