#include using namespace std; using ll = long long; int main() { int n, k; cin >> n >> k; k--; vector x(n), a(n); for (int i = 0; i < n; i++) { cin >> x.at(i); } for (int i = 0; i < n; i++) { cin >> a.at(i); } int li, ri; li = ri = k; ll ld = x.at(k) - a.at(k); ll rd = x.at(k) + a.at(k); bool update = true; while (update) { update = false; if (0 <= li - 1 && ld <= x.at(li - 1)) { ld = max(ld, x.at(li) - a.at(li)); rd = max(rd, x.at(li) + a.at(li)); li--; update = true; } if (ri + 1 < n && x.at(ri + 1) <= rd) { ld = max(ld, x.at(ri) - a.at(ri)); rd = max(rd, x.at(ri) + a.at(ri)); ri++; update = true; } } cout << ri - li + 1 << endl; }