#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair, int> PP; const ll INF = 1e15; const int MAX = 510000; const ll MOD = 1000000007; int main(void) { int N, K; cin >> N >> K; K--; vector X(N), A(N); for (int i = 0; i < N; i++) cin >> X[i]; for (int i = 0; i < N; i++) cin >> A[i]; int l, r, lX, rX; bool update = true; l = r = K; lX = X[K] - A[K]; rX = X[K] + A[K]; while (update) { update = false; while (r < N && X[r] <= rX) { if (rX < X[r] + A[r]) { rX = X[r] + A[r]; update = true; } if (X[r] - A[r] < lX) { lX = X[r] - A[r]; update = true; } r++; } while (0 <= l && lX <= X[l]) { if (X[l] - A[l] < lX) { lX = X[l] - A[l]; update = true; } if (rX < X[l] + A[l]) { rX = X[l] + A[l]; update = true; } l--; } } cout << r - l - 1 << endl; }