#include using namespace std; #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back #define mp make_pair typedef long long ll; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } ll modpow(ll a, ll p) { if (p == 0) return 1; if (!(p % 2)) { ll halfP = p / 2; ll half = modpow(a, halfP); return half * half % mod; } else { return a * modpow(a, p - 1) % mod; } } ll comb(int a, int b) { if (b > a - b) return comb(a, a - b); ll ansMul = 1; ll ansDiv = 1; for (int i = 0; i < b; i++) { ansMul *= a - i; ansDiv *= i + 1; ansMul %= mod; ansDiv %= mod; } ll ans = ansMul * modpow(ansDiv, mod - 2) % mod; return ans; } /* int num = 200010; vector fact(num), ifact(num); fact[0] = 1; fact[1] = 1; for (int i = 2; i < num; i++) { fact[i] = fact[i-1] * i; fact[i] %= mod; } for (int i = 0; i < num; i++) { ifact[i] = modpow(ifact[i], mod-2); ifact[i] %= mod; } */ int main() { int N, K; cin >> N >> K; vector X(N), A(N); rep(i, N) cin >> X[i]; rep(i, N) cin >> A[i]; K--; ll l = X[K] - A[K]; ll r = X[K] + A[K]; int res = 0; rep(k, N) { int ld = lower_bound(all(X), l) - X.begin(); int rd = lower_bound(all(X), r) - X.begin(); if (r != X[rd]) rd--; for (int i = ld; i <= rd; i++) { l = min(l, X[i] - A[i]); r = max(r, X[i] + A[i]); } int tmp = res; res = rd - ld + 1; if (res == tmp) break; } cout << res << endl; return 0; }