#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 - '0' + c, c = getchar();
  x *= f;
}
const int N = 1e5 + 10, M = N * 4;
const long long inf = 1e16;
long long sum[M], mx[M], mi[M], tg[M];
inline void add(int c, long long t) { tg[c] += t, sum[c] += t, mx[c] += t; }
inline void push_down(int c) {
  if (tg[c]) add((c << 1), tg[c]), add((c << 1 | 1), tg[c]), tg[c] = 0;
}
long long query(int l, int r, int c, long long v) {
  if (l == r) return v + mi[c];
  int mid = l + r >> 1;
  push_down(c);
  if (v <= mx[(c << 1)]) return min(query(l, mid, (c << 1), v), sum[c]);
  return min(v + mi[(c << 1)], query(mid + 1, r, (c << 1 | 1), v));
}
void push_up(int c, int l, int r) {
  mx[c] = max(mx[(c << 1)], mx[(c << 1 | 1)]);
  int mid = l + r >> 1;
  sum[c] = query(mid + 1, r, (c << 1 | 1), mx[(c << 1)]);
}
long long suf[N], pre[N];
void build(int l, int r, int c) {
  if (l == r) return (void)(mi[c] = -suf[l], mx[c] = suf[l], sum[c] = inf);
  int mid = l + r >> 1;
  build(l, mid, (c << 1)), build(mid + 1, r, (c << 1 | 1));
  mi[c] = min(mi[(c << 1)], mi[(c << 1 | 1)]);
  push_up(c, l, r);
}
int ql, qr;
long long qt;
void upd(int l, int r, int c) {
  if (ql <= l && qr >= r) return add(c, qt);
  int mid = l + r >> 1;
  push_down(c);
  if (ql <= mid) upd(l, mid, (c << 1));
  if (qr > mid) upd(mid + 1, r, (c << 1 | 1));
  push_up(c, l, r);
}
int m, n, g[N], w[N];
int Q(int l, int r, int c, long long d) {
  if (query(l, r, c, d) > m) return 0;
  if (l == r) return l;
  int mid = l + r >> 1, t = 0;
  push_down(c);
  if (t = Q(mid + 1, r, (c << 1 | 1), max(d, mx[(c << 1)]))) return t;
  return Q(l, mid, (c << 1), d);
}
void ins(int x, int f, int d) {
  if (f <= n) {
    ql = f - 1, qr = n, qt = d * (pre[x] - pre[f]);
    upd(1, n, 1);
  }
}
int st[N], top;
int main() {
  rd(n), rd(m);
  for (int i = 1; i < n; ++i) rd(w[i]);
  for (int i = 1; i <= n; ++i) rd(g[i]);
  for (int i = 1; i <= n; ++i) {
    pre[i] = pre[i - 1] + g[i - 1] - w[i - 1];
    suf[i] = suf[i - 1] + g[i] - w[i - 1];
  }
  build(1, n, 1);
  st[0] = n + 1;
  int ans = 0;
  for (int i = n; i >= 1; --i) {
    while (top && pre[st[top]] >= pre[i]) ins(st[top], st[top - 1], -1), top--;
    ins(i, st[top], 1);
    st[++top] = i;
    int lb = 0, rb = top;
    while (lb < rb) {
      int mid = lb + rb >> 1;
      if (pre[i] - pre[st[mid]] <= m)
        rb = mid;
      else
        lb = mid + 1;
    }
    if (i > 1) {
      ql = 1, qr = i - 1, qt = -inf;
      upd(1, n, 1);
    }
    if (rb > 1) {
      ql = st[rb - 1] - 1, qr = n, qt = inf;
      upd(1, n, 1);
    }
    ans = max(ans, Q(1, n, 1, -inf) - i + 1);
    if (i > 1) {
      ql = 1, qr = i - 1, qt = inf;
      upd(1, n, 1);
    }
    if (rb > 1) {
      ql = st[rb - 1] - 1, qr = n, qt = -inf;
      upd(1, n, 1);
    }
  }
  printf("%d", ans);
  return 0;
}
