#include #define rep(i, a, n) for(int i = a; i < n; i++) #define int long long using namespace std; typedef pair P; const int mod = 1000000007; const int INF = 1e18; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector

d(n); rep(i, 0, n) cin >> d[i].first; rep(i, 0, n) cin >> d[i].second; int preX = d[k - 1].first; sort(d.begin(), d.end()); k = lower_bound(d.begin(), d.end(), P{preX, 0}) - d.begin(); int r = d[k].first + d[k].second; int l = d[k].first - d[k].second; int rid = k + 1, lid = k - 1; while(1){ bool f = false; while(rid < n && d[rid].first <= r){ f = true; r = max(r, d[rid].first + d[rid].second); rid++; } while(lid >= 0 && d[lid].first >= l){ f = true; l = min(l, d[lid].first - d[lid].second); lid--; } if(!f) break; } int ans = 0; rep(i, 0, n) if(l <= d[i].first && d[i].second <= r) ans++; cout << ans << endl; }