#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) {
    if (ch == '-') f = -1;
  }
  for (; isdigit(ch); ch = getchar()) {
    x = x * 10 + ch - '0';
  }
  return x * f;
}
const int N = 1e6;
const long long INF = 1e16;
long long a[N + 3], b[N + 3], f[N + 3], g[N + 3];
int stk[N + 3];
int n, tp;
long long m;
int ans;
struct SgTNode {
  long long h, g, tag;
  SgTNode() { h = INF, g = -INF; }
} sgt[(N << 2) + 3];
void pushdown(int u) {
  if (!sgt[u].tag) return;
  long long tag = sgt[u].tag;
  sgt[u << 1].h += tag, sgt[u << 1].tag += tag;
  sgt[u << 1 | 1].h += tag, sgt[u << 1 | 1].tag += tag;
  sgt[u].tag = 0ll;
}
void updateg(int u, int le, int ri, int pos) {
  if (le == ri) {
    sgt[u].g = sgt[u].h = g[pos];
    return;
  }
  int mid = (le + ri) >> 1;
  pushdown(u);
  if (pos <= mid) {
    updateg(u << 1, le, mid, pos);
  } else {
    updateg(u << 1 | 1, mid + 1, ri, pos);
  }
  sgt[u].g = min(sgt[u << 1].g, sgt[u << 1 | 1].g);
  sgt[u].h = min(sgt[u << 1].h, sgt[u << 1 | 1].h);
}
void addh(int u, int le, int ri, int lb, int rb, long long x) {
  if (le >= lb && ri <= rb) {
    sgt[u].h += x, sgt[u].tag += x;
    return;
  }
  int mid = (le + ri) >> 1;
  pushdown(u);
  if (lb <= mid) {
    addh(u << 1, le, mid, lb, rb, x);
  }
  if (rb > mid) {
    addh(u << 1 | 1, mid + 1, ri, lb, rb, x);
  }
  sgt[u].h = min(sgt[u << 1].h, sgt[u << 1 | 1].h);
}
int query(int u, int le, int ri, int rb, long long x) {
  if (le > rb) {
    return -1;
  }
  if (le == ri) {
    return le;
  }
  int mid = (le + ri) >> 1;
  pushdown(u);
  long long lv = min(x, sgt[u << 1].h);
  if (rb > mid && lv >= sgt[u << 1 | 1].g - m) {
    int ret = query(u << 1 | 1, mid + 1, ri, rb, lv);
    if (ret != -1) return ret;
  }
  if (sgt[u << 1].g - m <= x) return query(u << 1, le, mid, rb, x);
  return -1;
}
int main() {
  scanf("%d%I64d", &n, &m);
  for (int i = 1; i < n; i++) scanf("%I64d", &b[i]);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (int i = 1; i <= n; i++) f[i] = f[i - 1] + a[i - 1] - b[i - 1];
  for (int i = 1; i <= n; i++) g[i] = g[i - 1] + b[i - 1] - a[i];
  stk[0] = n + 1;
  f[n + 1] = -INF;
  for (int i = n; i >= 1; i--) {
    updateg(1, 1, n, i);
    while (tp > 0 && f[stk[tp]] >= f[i]) {
      if (tp > 1) {
        addh(1, 1, n, stk[tp - 1] - 1, n, f[stk[tp]] - f[stk[tp - 1]]);
      }
      tp--;
    }
    tp++;
    stk[tp] = i;
    if (tp > 1) {
      addh(1, 1, n, stk[tp - 1] - 1, n, f[stk[tp - 1]] - f[stk[tp]]);
    }
    int left = 0, right = tp;
    while (left < right) {
      int mid = (left + right + 1) >> 1;
      if (f[i] - f[stk[mid]] > m) {
        left = mid;
      } else {
        right = mid - 1;
      }
    }
    int r = stk[left] - 1;
    int ret = query(1, 1, n, r, INF);
    ans = max(ans, ret - i + 1);
  }
  printf("%d\n", ans);
  return 0;
}
