// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let m = get!();
    let mut xs = vec![0; n+1];
    for i in 0..n {
    	let x = get!();
    	xs[i+1]=(x+xs[i]) % m;
    }
    xs[0] = m;
    xs.sort();
    let mut ans = 0;
    for i in 0..xs.len()-1 {
    	if xs[i] == xs[i+1] {
        	ans += 1;
        }
    }
    println!("{}", ans);
}

