#include #include using namespace std; int main(){ long long n,k;cin>>n>>k; vector X(n),A(n); for(int i = 0; n > i; i++)cin>>X[i]; for(int i = 0; n > i; i++)cin>>A[i]; vector G(n); queue b; b.push(k-1); int nwl = k-1,nwr = k-1; while(b.size()){ auto z = b.front();b.pop(); while(nwr+1 != n && X[nwr+1]-X[z] <= A[z]){ nwr++; b.push(nwr); } while(nwl-1 >= 0 && X[z]-X[nwl-1] <= A[z]){ nwl--; b.push(nwl); } } cout << nwr-nwl+1 << endl; }