#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair P; int main(){ int n, k; cin >> n >> k; k--; vector x(n), a(n); rep(i,n) cin >> x[i]; rep(i,n) cin >> a[i]; queue que; que.push(k); int minl = n+1, maxr = 0; vector ok(n,false); while (!que.empty()){ int i = que.front(); que.pop(); ok[i] = true; int l = lower_bound(x.begin(), x.end(), x[i] - a[i]) - x.begin(); int r = upper_bound(x.begin(), x.end(), x[i] + a[i]) - x.begin(); r--; if (!ok[l]) que.push(l); if (!ok[r]) que.push(r); if (minl > l) minl = l; if (maxr < r) maxr = r; //cout << l << " " << r << endl; } cout << maxr - minl + 1 << endl; return 0; }