use std::io::Read; fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n = it.next().unwrap().parse::().unwrap() + 2; let k = it.next().unwrap().parse::().unwrap(); let mut x = vec![-1_000_000_000_000_000_000i64; n]; for i in 1..(n - 1) { x[i] = it.next().unwrap().parse().unwrap(); } x[n - 1] = -x[n - 1]; let mut a = vec![0i64; n]; for i in 1..(n - 1) { a[i] = it.next().unwrap().parse().unwrap(); } let mut i = k + 1; let mut r = x[k] + a[k]; while x[i] <= r { r = std::cmp::max(r, x[i] + a[i]); i += 1; } let mut j = k - 1; let mut l = x[k]- a[k]; while x[j] >= l { l = std::cmp::min(l, x[j] - a[j]); j -= 1; } let ans = i - j - 1; println!("{}", ans); } fn main() { run(); }