#include using namespace std; using ll = long long; void solve(int cur, int& L, int& R, vector& x, vector& a) { int li = lower_bound(x.begin(), x.end(), x[cur] - a[cur]) - x.begin(); int ri = upper_bound(x.begin(), x.end(), x[cur] + a[cur]) - x.begin(); int nL = L; if (li < L) nL = li; int nR = R; if (ri > R) nR = ri; vector ids; for (int i = li; i < ri; ) { if (i >= L && i < R) { i = R; continue; } ids.push_back(i); i++; } L = nL; R = nR; for (int i : ids) { solve(i, L, R, x, a); } } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, K; cin >> n >> K; K--; vector x(n); for (int i = 0; i < n; i++) cin >> x[i]; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int L = K; int R = K + 1; solve(K, L, R, x, a); cout << R - L << endl; return 0; }