use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let m: usize = itr.next().unwrap().parse().unwrap(); let p: usize = itr.next().unwrap().parse().unwrap(); let a: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut max1 = 0; let mut max2 = 0; for &e in a.iter() { max1 = std::cmp::max(max1, e); if e % p != 0 { max2 = std::cmp::max(max2, e); } } if max1 > m { println!("{}", 1); } else if max2 <= 1 { println!("-1"); } else { let mut now = 1; let mut ans = 0; while max1 * now <= m { ans += 1; now *= max2; } println!("{}", ans + 1); } }