#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; sort(d.begin(), d.end()); k--; int r = d[k].first + d[k].second; int l = d[k].first - d[k].second; int ans = 0; rep(i, k + 1, n){ if(d[i].first <= r){ r = max(r, d[i].first + d[i].second); l = min(l, d[i].first - d[i].second); } } for(int i = k - 1; i >= 0; i--){ if(d[i].first >= l){ r = max(r, d[i].first + d[i].second); l = min(l, d[i].first - d[i].second); } } rep(i, 0, n) if(l <= d[i].first && d[i].second <= r) ans++; cout << ans << endl; }