Problem: Kekoland is a country with n beautiful cities numbered from left to right and connected by n - 1 roads. The i-th road connects cities i and i + 1 and length of this road is wi kilometers. 

When you drive in Kekoland, each time you arrive in city i by car you immediately receive gi liters of gas. There is no other way to get gas in Kekoland.

You were hired by the Kekoland president Keko to organize the most beautiful race Kekoland has ever seen. Let race be between cities l and r (l ≤ r). Race will consist of two stages. On the first stage cars will go from city l to city r. After completing first stage, next day second stage will be held, now racers will go from r to l with their cars. Of course, as it is a race, racers drive directly from start city to finish city. It means that at the first stage they will go only right, and at the second stage they go only left. Beauty of the race between l and r is equal to r - l + 1 since racers will see r - l + 1 beautiful cities of Kekoland. Cars have infinite tank so racers will take all the gas given to them.

At the beginning of each stage racers start the race with empty tank (0 liters of gasoline). They will immediately take their gasoline in start cities (l for the first stage and r for the second stage) right after the race starts. 

It may not be possible to organize a race between l and r if cars will run out of gas before they reach finish.

You have k presents. Each time you give a present to city i its value gi increases by 1. You may distribute presents among cities in any way (also give many presents to one city, each time increasing gi by 1). What is the most beautiful race you can organize?

Each car consumes 1 liter of gas per one kilometer.

Input

The first line of the input contains two integers n and k (2 ≤ n ≤ 100 000, 0 ≤ k ≤ 109) — the number of cities in Kekoland and the number of presents you have, respectively.

Next line contains n - 1 integers. The i-th of them is wi (1 ≤ wi ≤ 109) — the length of the road between city i and i + 1. 

Next line contains n integers. The i-th of them is gi (0 ≤ gi ≤ 109) — the amount of gas you receive every time you enter city i.

Output

Print a single line — the beauty of the most beautiful race you can organize.

Examples

Input

4 4
2 2 2
1 1 1 1


Output

4


Input

8 5
2 2 2 3 7 3 1
1 3 1 5 4 0 2 5


Output

7

Note

In first sample if you give one present to each city then it will be possible to make a race between city 1 and city 4.

In second sample you should add 1 to g5 and 4 to g6, then it will be possible to make a race between cities 2 and 8. 

Solution (in CPP):

Solution:
#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;
}