#include using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) using ll = long long; using pll = pair; constexpr ll INF = (1LL<<60); constexpr ll MOD = (1e9+7); //constexpr ll MOD = (998244353); template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} void dump(){cout< void dump(T&& h, Ts&&... t){cout<(t)...);} template istream &operator>>(istream&is,vector&v){for(auto &elemnt:v)is>>elemnt;return is;} template istream &operator>>(istream&is,pair&p){is>>p.first>>p.second;return is;} templatevector make_vector(size_t a){return vector(a);} templateauto make_vector(size_t a, Ts... ts){return vector(ts...))>(a, make_vector(ts...));} void solve1(); main(){solve1();} template class segtree { private: ll n=1; T unit; std::vector dat; std::function func; public: segtree(){} segtree(std::vector& a,T v,std::function f){ build(a,v,f); } void build(std::vector& a,T v,std::function f){ ll sz=a.size(); unit=v; func=f; while(n=0;--i){ dat[i]=func(dat[i*2+1],dat[i*2+2]); } } void update(ll idx,T val){ idx+=n-1; dat[idx]=val; while(idx){ idx--;idx>>=1LL; dat[idx]=func(dat[idx*2+1],dat[idx*2+2]); } } T query(ll a,ll b,ll k=0,ll l=0,ll r=-1){ if(r<0)r=n; if( b<=l || r<=a )return unit; if( a<=l && r<=b )return dat[k]; else{ auto left=query(a,b,2*k+1,l,(l+r)/2); auto right=query(a,b,2*k+2,(l+r)/2,r); return func(left,right); } } }; void solve1(){ ll n,k; cin>>n>>k; k--; vector x(n),a(n); cin>>x>>a; vector left(n),right(n); rep(i,n){ left[i].first=x[i]+a[i]; right[i].first=x[i]-a[i]; left[i].second=right[i].second=i; } segtree leftmax(left,pll(-INF,-INF),[](auto a,auto b){return max(a,b);}); segtree rightmin(right,pll(INF,INF),[](auto a,auto b){return min(a,b);}); ll low=k,high=k; vector seen(n,false); queue que; que.emplace(k); while(!que.empty()){ ll i = que.front(); que.pop(); if(seen[i])continue; seen[i]=true; auto litr = upper_bound(x.begin(),x.end(),left[i].first); litr--; ll lidx = litr-x.begin(); chmax(high,lidx); pll lm = leftmax.query(i,lidx+1); que.emplace(lm.second); auto ritr = lower_bound(x.begin(),x.end(),right[i].first); ll ridx = ritr-x.begin(); chmin(low,ridx); pll rm = rightmin.query(ridx,i+1); que.emplace(rm.second); } cout<<(high-low+1)<