#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { int n, k; cin >> n >> k; vector x(n); rep(i, n) cin >> x[i]; vector a(n); rep(i, n) cin >> a[i]; bool left = true; bool right = true; int count = 1; llong left_val = x[k-1] - a[k-1]; llong right_val = x[k-1] + a[k-1]; int left_idx = k-1; int right_idx = k-1; while (left || right) { while (left && left_idx-1 >= 0) { if(x[left_idx-1] < left_val) { left = false; } else { left_idx -= 1; left_val = min(left_val, x[left_idx] - a[left_idx]); right_val = max(right_val, x[left_idx] + a[left_idx]); if(right_val == x[left_idx] + a[left_idx]) right = true; count += 1; } } left = false; while (right && right_idx+1 < n) { if(x[right_idx+1] > right_val) { right = false; } else { right_idx += 1; right_val = max(right_val, x[right_idx] + a[right_idx]); left_val = min(left_val, x[right_idx] - a[right_idx]); if(left_val == x[right_idx] - a[right_idx]) left = true; count += 1; } } right = false; } cout << count << endl; }