use std::collections::HashMap; use std::io::Write; /* ----------------------------------------------- */ fn run(sc: &mut scanner::Scanner, out: &mut std::io::BufWriter) { let n: usize = sc.next(); let m: usize = sc.next(); let v: Vec = sc.next_vec(n); let mut map = HashMap::new(); for x in v { let p = map.entry(x % m).or_insert(0); *p += 1 } let mut ans = 0; for x in 1..(m + 1) >> 1 { ans += std::cmp::max(map.get(&x).unwrap_or(&0), map.get(&(m - x)).unwrap_or(&0)); } ans += std::cmp::min(1, *map.get(&0).unwrap_or(&0)); if m & 1 == 0 { ans += std::cmp::min(1, *map.get(&(m >> 1)).unwrap_or(&0)); } writeln!(out, "{:?}", ans).ok(); } /* ----------------------------------------------- */ #[allow(dead_code)] mod scanner { use std::str::FromStr; pub struct Scanner<'a> { it: std::str::SplitWhitespace<'a>, } impl<'a> Scanner<'a> { pub fn new(s: &'a String) -> Scanner<'a> { Scanner { it: s.split_whitespace(), } } pub fn next(&mut self) -> T { self.it.next().unwrap().parse::().ok().unwrap() } pub fn next_bytes(&mut self) -> Vec { self.it.next().unwrap().bytes().collect() } pub fn next_chars(&mut self) -> Vec { self.it.next().unwrap().chars().collect() } pub fn next_vec(&mut self, len: usize) -> Vec { (0..len).map(|_| self.next()).collect() } } } /* ----------------------------------------------- */ fn main() { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut sc = scanner::Scanner::new(&s); let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); run(&mut sc, &mut out); } /* ----------------------------------------------- */