fn main() { let mut nmp = String::new(); std::io::stdin().read_line(&mut nmp).ok(); let nmp: Vec = nmp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nmp[0]; let m = nmp[1]; let p = nmp[2]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let maxval = *a.iter().max().unwrap(); if maxval >= m { println!("1"); return; } if a.iter().filter(|&&v| v % p > 0).count() == 0 { println!("-1"); return; } let basemax= *a.iter().filter(|&&v| v % p > 0).max().unwrap(); if basemax == 1 { println!("-1"); return; } let mut cnt = 1; let mut x = maxval; while x < m { x *= basemax; cnt += 1; } println!("{}", cnt); }