#include <bits/stdc++.h>
using namespace std;
int n;
long long gg[100100], ww[100100], sum[6][100100], nxt[100100], dist[100010],
    pre[100001], ps[100001], k;
long long ax[33], in, now, fk[20][100100], fs[20][100100], dx[100100],
    bk[20][100100], bm[20][100100], nv;
int ix[33], cnt, pv, lg[100100];
int ans, hg, vis[100100], times, to[100100];
long long rmq(int l, int r, int id) {
  if (l > r) return 0;
  long long now, res, rs;
  int mk, ll = l, rr = r;
  mk = lg[r - l + 1];
  if (id == 2)
    rs = max(0LL, max(fs[mk][l], fk[mk][r + 1 - (1 << mk)] +
                                     sum[1][r - (1 << mk)] - sum[1][l - 1]));
  if (id == 1)
    rs = min(0LL, min(fk[mk][r + 1 - (1 << mk)],
                      fk[mk][l] + sum[1][r] - sum[1][l + (1 << mk) - 1]));
  if (id == 3)
    rs = min(0LL, min(bk[mk][r + 1 - (1 << mk)],
                      bk[mk][l] + sum[4][r] - sum[4][l + (1 << mk) - 1]));
  now = res = 0;
  if (id == 2) {
    for (mk = 19; mk >= 0; mk--) {
      if (l + (1 << mk) <= r + 1) {
        if (res < now + fs[mk][l]) res = now + fs[mk][l];
        now += sum[1][l + (1 << mk) - 1] - sum[1][l - 1];
        l += (1 << mk);
      }
    }
  } else if (id == 1) {
    for (mk = 19; mk >= 0; mk--) {
      if (l + (1 << mk) <= r + 1) {
        if (res > now + fk[mk][r + 1 - (1 << mk)])
          res = now + fk[mk][r + 1 - (1 << mk)];
        now += sum[1][r] - sum[1][r - (1 << mk)];
        r -= (1 << mk);
      }
    }
  } else if (id == 3) {
    for (mk = 19; mk >= 0; mk--) {
      if (l + (1 << mk) <= r + 1) {
        if (res > now + bk[mk][r + 1 - (1 << mk)])
          res = now + bk[mk][r + 1 - (1 << mk)];
        now += sum[4][r] - sum[4][r - (1 << mk)];
        r -= (1 << mk);
      }
    }
  }
  if (rs != res && id != 2)
    printf("rs=%I64d,res=%I64d,l=%d,r=%d,id=%d\n", rs, res, ll, rr, id);
  return res;
}
int main() {
  int i, j, s, p, q, low, high, mid, ms, up;
  long long ns, mv, bv;
  scanf("%d%I64d", &n, &k);
  lg[1] = 0;
  for (i = 2; i <= n; i++) lg[i] = lg[i / 2] + 1;
  for (i = 1; i <= n - 1; i++) scanf("%I64d", &ww[i]);
  for (i = 1; i <= n; i++) scanf("%I64d", &gg[i]);
  for (i = 0; i < 6; i++) sum[i][0] = 0;
  for (i = 1; i <= n - 1; i++) sum[0][i] = sum[0][i - 1] + gg[i] - ww[i];
  for (i = 1; i <= n - 1; i++) sum[1][i] = sum[1][i - 1] + gg[i + 1] - ww[i];
  for (i = 1; i <= n - 1; i++)
    sum[2][i] = sum[2][i - 1] + gg[i] - ww[i] + gg[i + 1] - ww[i];
  nxt[n - 1] = n;
  for (i = n - 2; i >= 0; i--) {
    j = i + 1;
    while (j < n && sum[0][j] >= sum[0][i]) j = nxt[j];
    nxt[i] = j;
  }
  memset(dist, 0, sizeof(dist));
  memset(pre, -1, sizeof(pre));
  for (i = 0; i < n; i++) {
    j = nxt[i];
    ps[i] = i;
    dist[j] = max(dist[j], dist[i] + 1);
  }
  for (i = 0; i < n; i++) {
    j = nxt[i];
    if (dist[j] == dist[i] + 1) pre[j] = i;
  }
  memset(dx, 0, sizeof(dx));
  for (i = 0; i < n; i++) ps[i] = i;
  for (i = n - 1; i >= 0; i--) {
    if (pre[i] >= 0) {
      ps[pre[i]] = ps[i];
      dx[i] = sum[0][i] - sum[0][pre[i]];
    }
  }
  memset(to, -1, sizeof(to));
  for (i = 0; i < n; i++) {
    if (to[ps[i]] < 0) to[ps[i]] = i;
  }
  for (i = 1; i <= n - 1; i++) fk[0][i] = gg[i + 1] - ww[i];
  for (j = 1; (1 << j) <= n; j++)
    for (i = 1; i + (1 << j) <= n; i++)
      fk[j][i] = min(fk[j - 1][i] + sum[1][i + (1 << j) - 1] -
                         sum[1][i + (1 << (j - 1)) - 1],
                     fk[j - 1][i + (1 << (j - 1))]);
  for (i = 1; i <= n - 1; i++) fs[0][i] = gg[i + 1] - ww[i];
  for (j = 1; (1 << j) <= n; j++)
    for (i = 1; i + (1 << j) <= n; i++) {
      nv = sum[1][i + (1 << (j - 1)) - 1] - sum[1][i - 1];
      fs[j][i] = max(fs[j - 1][i], nv + fs[j - 1][i + (1 << (j - 1))]);
    }
  memset(vis, -1, sizeof(vis));
  times = 0;
  for (i = 0; i < n; i++) {
    if (ps[i] == i) {
      j = to[i];
      if (j >= 0 && j < i) {
        for (s = j; s <= i; s = nxt[s]) vis[s] = times;
        for (s = j + 1; s <= i; s++) {
          if (vis[s] == times) {
            sum[5][s] = dx[s];
            sum[4][s] = gg[s + 1] - ww[s] - dx[s];
          } else {
            sum[4][s] = gg[s + 1] - ww[s];
            sum[5][s] = 0;
          }
          if (s > j + 1) {
            sum[4][s] += sum[4][s - 1];
            sum[5][s] += sum[5][s - 1];
          }
        }
        for (s = j + 1; s <= i; s++) bk[0][s] = gg[s + 1] - ww[s];
        for (p = 1; (1 << p) <= i - j; p++)
          for (s = j + 1; s + (1 << p) <= i + 1; s++)
            bk[p][s] = min(bk[p - 1][s] + sum[4][s + (1 << p) - 1] -
                               sum[4][s + (1 << (p - 1)) - 1],
                           bk[p - 1][s + (1 << (p - 1))]);
      }
    }
    times++;
  }
  ans = 0;
  for (i = 0; i < n; i++) {
    j = i;
    cnt = 0;
    while (j < n) {
      ix[cnt++] = j;
      if (ps[j] != j)
        j = ps[j];
      else
        j = nxt[j];
    }
    ix[cnt] = n;
    in = pv = now = 0;
    hg = -1;
    for (j = 0; j < cnt; j++) {
      if (ps[ix[j]] == ix[j + 1]) {
        if (now + sum[5][ix[j + 1]] - sum[5][ix[j]] < -k) {
          low = ix[j] + 1;
          high = ix[j + 1];
          while (low <= high) {
            mid = (low + high) >> 1;
            nv = now + sum[5][mid] - sum[5][ix[j]];
            if (nv >= -k)
              low = mid + 1;
            else
              high = mid - 1;
          }
          hg = min(high, n - 1);
          break;
        }
        now += sum[5][ix[j + 1]] - sum[5][ix[j]];
      } else {
        if (j + 1 == cnt) {
          hg = n - 1;
          break;
        }
        if (now + sum[0][ix[j + 1]] - sum[0][ix[j]] < -k) {
          hg = ix[j + 1] - 1;
          break;
        }
        now += sum[0][ix[j + 1]] - sum[0][ix[j]];
      }
    }
    if (hg < 0) hg = n - 1;
    j = min(j, cnt - 1);
    up = j;
    if (j >= 1) {
      ax[j + 1] = 0;
      for (; j >= 0; j--) {
        if (j == up) {
          if (ix[j] + 1 <= hg)
            ax[j] = rmq(ix[j] + 1, hg, 2);
          else
            ax[j] = 0;
        } else
          ax[j] = max(rmq(ix[j] + 1, ix[j + 1], 2),
                      ax[j + 1] + sum[1][ix[j + 1]] - sum[1][ix[j]]);
      }
      in = pv = now = 0;
      for (j = 0; j <= up; j++) {
        long long tin, tnow;
        tin = in;
        tnow = now;
        if (ps[ix[j]] == ix[j + 1]) {
          if (j < up) {
            nv = rmq(ix[j] + 1, ix[j + 1], 3);
            if (in == 0)
              in = nv;
            else
              in = min(in + sum[4][ix[j + 1]] - sum[4][ix[j]], nv);
            now += sum[5][ix[j + 1]] - sum[5][ix[j]];
          } else {
            if (ix[j] + 1 <= hg)
              nv = rmq(ix[j] + 1, hg, 3);
            else
              nv = 0;
            if (in == 0)
              in = nv;
            else if (ix[j] + 1 <= hg)
              in = min(in + sum[4][hg] - sum[4][ix[j]], nv);
            now += sum[5][hg] - sum[5][ix[j]];
          }
        } else {
          ms = ix[j + 1] - 1;
          if (j == up) ms = min(ms, hg);
          if (ix[j] + 1 <= ms)
            nv = rmq(ix[j] + 1, ms, 1);
          else
            nv = 0;
          if (j != up) {
            if (nv != 0)
              nv += gg[ix[j + 1] + 1] - ww[ix[j + 1]] + sum[0][ix[j]] -
                    sum[0][ix[j + 1]];
            else
              nv = min(nv, gg[ix[j + 1] + 1] - ww[ix[j + 1]]);
            mv = gg[ix[j + 1] + 1] - ww[ix[j + 1]];
            if (nv > mv) nv = mv;
          }
          if (j == up)
            bv = in + sum[1][hg] - sum[1][ix[j]];
          else {
            bv = in + sum[1][ix[j + 1]] - sum[1][ix[j]];
            if (!(in == 0 && ix[j] + 1 == ix[j + 1]))
              bv += sum[0][ix[j]] - sum[0][ix[j + 1]];
          }
          if (nv > bv) nv = bv;
          in = nv;
          if (j != up) now += sum[0][ix[j + 1]] - sum[0][ix[j]];
        }
        if (now + in + ax[j + 1] < -k) {
          pv = j;
          in = tin;
          now = tnow;
          break;
        }
      }
      if (j > up) {
        ans = max(ans, hg - i + 1);
        continue;
      }
    } else
      pv = in = now = 0;
    low = ix[pv] + 1;
    if (pv == up)
      high = hg;
    else
      high = ix[pv + 1];
    while (low <= high) {
      mid = (low + high) >> 1;
      bool fi = true;
      if (ps[ix[pv]] == ix[pv + 1]) {
        nv = 0;
        if (in != 0) nv = min(nv, in + sum[4][mid] - sum[4][ix[pv]]);
        nv = min(nv, rmq(ix[pv] + 1, mid, 3));
        long long bfm = nv;
        ns = now + bfm + sum[5][mid] - sum[5][ix[pv]];
        if (pv == up)
          nv = rmq(mid + 1, hg, 2);
        else
          nv = rmq(mid + 1, ix[pv + 1], 2);
        long long bp = ns + nv;
        if (bfm == 0 && nv != 0) bp += dx[mid + 1];
        if (bp < -k) fi = false;
      } else {
        ms = min(ix[pv + 1] - 1, mid);
        if (ix[pv] + 1 <= ms)
          nv = rmq(ix[pv] + 1, ms, 1);
        else
          nv = 0;
        if (mid >= ix[pv + 1]) {
          if (nv != 0)
            nv += gg[ix[pv + 1] + 1] - ww[ix[pv + 1]] + sum[0][ix[pv]] -
                  sum[0][ix[pv + 1]];
          else
            nv = min(nv, gg[ix[pv + 1] + 1] - ww[ix[pv + 1]]);
          mv = gg[ix[pv + 1] + 1] - ww[ix[pv + 1]];
          if (nv > mv) nv = mv;
        }
        bv = in + sum[1][mid] - sum[1][ix[pv]];
        if (mid >= ix[pv + 1] && !(in == 0 && ix[pv] + 1 == ix[pv + 1]))
          bv += sum[0][ix[pv]] - sum[0][ix[pv + 1]];
        if (nv > bv) nv = bv;
        long long bfm = nv;
        ns = now + nv;
        if (mid >= ix[pv + 1]) ns += sum[0][mid] - sum[0][ix[pv]];
        ms = ix[pv + 1];
        if (pv == up) ms = min(ms, hg);
        nv = 0;
        long long lv = 0;
        if (mid + 1 <= ms) lv = rmq(mid + 1, ms, 2);
        nv = max(0LL, lv);
        if (bfm == 0 && mid + 1 == ix[pv + 1] && ix[pv + 1] < n && lv != 0)
          nv += sum[0][ix[pv + 1]] - sum[0][ix[pv]];
        nv = max(0LL, nv);
        if (ns + nv < -k) fi = false;
      }
      if (fi)
        low = mid + 1;
      else
        high = mid - 1;
    }
    if (ans < high - i + 1) ans = high - i + 1;
  }
  printf("%d\n", ans);
  return 0;
}
