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 l = k; let mut r = k; let mut left = x[k] - a[k]; let mut right = x[k] + a[k]; let mut update = true; while update { update = false; // 左側のアップデート while l > 0 && left <= x[l-1] { update = true; left = min(x[l-1] - a[l-1], left); right = max(x[l-1] + a[l-1], right); l -= 1; //println!("{}", l); } while r + 1 < n && right >= x[r+1] { update = true; left = min(x[r+1] - a[r+1], left); right = max(x[r+1] + a[r+1], right); r += 1; //println!("{}", r); } //println!("l = {}, r = {}", l, r); } println!("{}", r - l +1); }