#include #include #include using namespace std; typedef long long ll; int main(){ 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]; ll ld = x[k]-a[k], rd = x[k]+a[k]; int l = k, r = k; bool update = true; while(update){ update = false; while(l-1 >= 0 && ld <= x[l-1]){ update = true; l--; ld = min(ld, x[l]-a[l]); rd = max(rd, x[l]+a[l]); } while(r+1 < n && x[r+1] <= rd){ update = true; r++; rd = max(rd, x[r]+a[r]); ld = min(ld, x[r]-a[r]); } } cout << r-l+1 << endl; return 0; }