use std::vec::Vec; use std::cmp::min; use std::cmp::max; fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::().split_whitespace().map(|e| e.parse().ok().unwrap()).collect() } fn main() { let (n, k) = { let v: Vec = read_vec(); (v[0], v[1] - 1) }; let x: Vec = read_vec(); let a: Vec = read_vec(); let mut ans: usize = 1; let mut wave_range = x[k] + a[k]; // 右側のカエル for i in k+1..n { if wave_range >= x[i] { wave_range = max(wave_range, x[i] + a[i]); ans += 1; } } let mut wave_range = x[k] - a[k]; // 左側のカエル for i in (0..k).rev() { if wave_range <= x[i] { wave_range = min(wave_range, x[i] - a[i]); ans += 1; } } println!("{}", ans); }