#include #include #include #include #include #include #include #include #include using namespace std; int main() { int n , k; cin >> n >> k; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } vector > p(n); for (int i = 0; i < n; i++) { p[i]= make_pair(a[i] - x[i] , a[i] + x[i]); } k--; vector cnt(n , 0); cnt[k] = 1; for (int i = k; i < n - 1; i++) { if (p[i].second >= a[i + 1]) cnt[i + 1] = cnt[i]; } for (int i = k; i >= 1; i--) { if (p[i].first <= a[i - 1]) cnt[i - 1] = cnt[i]; } int ans = 0; for (int i = 0; i < n; i++) { ans += cnt[i] > 0; } cout << ans << endl; return 0; }