// bf to check if wa
// pb_ds big CAT
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
#define RG register
#define IL __inline__ __attribute__((always_inline))
#define For(i, a, b) for(RG int i = a, ___u = b; i <= ___u; ++i)
#define Dor(i, a, b) for(RG int i = b, ___d = a; i >= ___d; --i)
#define Rep(i, a, b) for(RG int i = a, ___u = b; i != ___u; ++i)
#define dmin(a, b) ((a) < (b) ? (a) : (b))
#define dmax(a, b) ((a) > (b) ? (a) : (b))
#define cmin(a, b) ((a) > (b) ? (a) = (b), 1 : 0)
#define cmax(a, b) ((a) < (b) ? (a) = (b), 1 : 0)
#define diff(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define dabs(i) ((i) > 0 ? (i) : -(i))
typedef long long ll;

namespace pb_ds
{
	// 输入输出优化模板从此开始
	namespace io
	{
		const int MaxBuff = 1 << 15;
		const int Output = 1 << 21;
		char B[MaxBuff], *S = B, *T = B;
		#define getc() ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T) ? 0 : *S++)
		char Out[Output], *iter = Out;
		IL void flush()
		{
			fwrite(Out, 1, iter - Out, stdout);
			iter = Out;
		}
	}

	template<class Type> IL Type read()
	{
		using namespace io;
		RG char ch; RG Type ans = 0; RG bool neg = 0;
		while(ch = getc(), (ch < '0' || ch > '9') && ch != '-')	 ;
		ch == '-' ? neg = 1 : ans = ch - '0';
		while(ch = getc(), '0' <= ch && ch <= '9') ans = ans * 10 + ch - '0';
		return neg ? -ans : ans;
	}
	template<class Type> IL void print(RG Type x, RG char ch = '\n')
	{
		using namespace io;
		if(!x) *iter++ = '0';
		else
		{
			if(x < 0) *iter++ = '-', x = -x;
			static int S2[100]; RG int t = 0;
			while(x) S2[++t] = x % 10, x /= 10;
			while(t) *iter++ = '0' + S2[t--];
		}
		*iter++ = ch;
	}
	// 输入输出优化模板到此结束
#if 1
	const int MaxN = 131072;
	const ll inf = 1000000000000000000ll;
	int N, K, len[MaxN], gas[MaxN];
	ll old[MaxN], add[MaxN];

	struct Pointer{int to; Pointer *next;} *fir[MaxN], mem[MaxN];

	#define SonL (i << 1)
	#define SonR (i << 1 | 1)
	#define RanL l, m
	#define RanR m + 1, r
	#define NeedL ql <= m
	#define NeedR m < qr

	namespace Input
	{
		IL void main()
		{
			RG int (*F)() = read<int>;
			N = F(); K = F();
			Rep(i, 1, N) len[i] = F();
			For(i, 1, N) gas[i] = F();
		}
	}

	namespace BuildTree
	{
		ll sum[MaxN];
		int stack[MaxN];

		IL void main()
		{
			Rep(i, 1, N) sum[i] = sum[i - 1] + gas[i] - len[i];
			RG int top = 0, fai; RG ll tmp;
			stack[top] = N;
			stack[++top] = N - 1;
			RG Pointer *tot = mem;
			Dor(i, 1, N - 1)
			{
				tmp = sum[i - 1];
				while(top && tmp < sum[stack[top]]) --top;
				fai = stack[top];
				add[i] = (top ? sum[i - 1] - sum[fai++] : 0);
				stack[++top] = i - 1;
				*++tot = (Pointer) {i, fir[fai]}; fir[fai] = tot;
///*lgg*/printf("i = %d tmp = %lld fa = %d add = %lld\n", i, tmp, fai, add[i]);
			}
		}
	}

	struct Data
	{
		ll min_old, max_cur, min_ans, rig_con;
		ll add;
		IL void do_add(RG ll x)
		{
			add += x;
			max_cur += x;
			min_ans += x;
			rig_con += x;
		}
		bool is_leaf;
	}	T[MaxN << 1];

	IL void push_down(RG int i)
	{
		if(T[i].add)
		{
			T[SonL].do_add(T[i].add);
			T[SonR].do_add(T[i].add);
			T[i].add = 0;
		}
	}

	IL ll query_cut(RG int i, RG ll cut)
	{
		RG ll ans = inf;
		while(!T[i].is_leaf && cut < T[i].max_cur)
		{
			if(cut <= T[SonL].max_cur)
			{
				cmin(ans, T[i].rig_con);
				i = SonL;
			}
			else
			{
				cmin(ans, cut + T[SonL].min_old);
				i = SonR;
			}
		}
		cmax(cut, T[i].max_cur);
		cmin(ans, cut + T[i].min_old);
		return ans;
	}

	IL void push_up(RG int i)
	{
		RG Data *p = T + i;
		if(T[SonL].max_cur >= T[SonR].max_cur)
		{
			p->max_cur = T[SonL].max_cur;
			p->rig_con = T[SonL].max_cur + T[SonR].min_old;
		}
		else
		{
			p->max_cur = T[SonR].max_cur;
			p->rig_con = query_cut(SonR, T[SonL].max_cur);
		}
		p->min_ans = dmin(T[SonL].min_ans, p->rig_con);
	}

/*lgg*/ll bf_sum[MaxN];
	void build(RG int i, RG int l, RG int r)
	{
/*lgg*/For(i,1,N) bf_sum[i]=old[i];return;
		if(l == r)
		{
			T[i] = (Data) {-old[i], old[i], 0ll};
			T[i].is_leaf = 1;
		}
		else
		{
			RG int m = (l + r) >> 1;
			build(SonL, RanL);
			build(SonR, RanR);
			T[i].min_old = dmin(T[SonL].min_old, T[SonR].min_old);
			push_up(i);
		}
	}

	int ql, qr, qp; ll qv;
	void modify(RG int i, RG int l, RG int r) // [ql, qr] += qv
	{
/*lgg*/For(i, ql, qr) bf_sum[i] += qv;
///*lgg*/printf("modify bf_sum = "); For(i, 1, N) printf("%lld ", bf_sum[i]); puts("");
/*lgg*/return;
		if(ql <= l && r <= qr)
			return T[i].do_add(qv);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(NeedL) modify(SonL, RanL);
		if(NeedR) modify(SonR, RanR);
		push_up(i);
	}
	void query(RG int i, RG int l, RG int r, RG ll qc)
	{
/*lgg*/RG ll max = -inf; For(i, ql, qr) {cmax(max, bf_sum[i]); if(max - old[i] <= K) qp = i;} return;
		if(ql <= l && r <= qr)
		{
			RG ll qv = query_cut(i, qc);
///*lgg*/printf("query [%d, %d] qv = %lld\n", l, r, qv);
			if(qv > K) {return;}
			if(l == r) {qp = l; return;}
		}
		RG int m = (l + r) >> 1;
		push_down(i);
		// right first
		if(!qp && NeedR) 	query(SonR, RanR, dmax(qc, T[SonL].max_cur));
		if(!qp && NeedL) 	query(SonL, RanL, qc);
	}

	int ans = 1;
	void dfs_make(RG int p)
	{
		qp = 0;
		ql = p; qr = N;
		query(1, 1, N, -inf);
		cmax(ans, qp - p + 1);
///*lgg*/printf("dfs_make p = %d qp = %d\n", p, qp);
		for(RG Pointer *k = fir[p]; k; k = k->next)
		{
			ql = p - 1; qr = N;
			qv = add[k->to];
			modify(1, 1, N);

			dfs_make(k->to);

			ql = p - 1; qr = N;
			qv = -add[k->to];
			modify(1, 1, N);
		}
	}

	IL void main()
	{
		Input::main();
		BuildTree::main();
		For(i, 1, N) old[i] = old[i - 1] + gas[i] - len[i - 1];
///*lgg*/For(i, 1, N) printf("old[%d] = %lld\n", i, old[i]);
		build(1, 1, N);
		dfs_make(N);
		print(ans);
	}

#endif
}

int main()
{
	#define FILE "bin"
	// freopen(FILE ".in", "r", stdin); freopen(FILE ".out", "w", stdout);
	pb_ds::main();
	pb_ds::io::flush();
	fclose(stdin); fclose(stdout);
}

#if 0
#endif


// pb_ds big CAT
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
#define RG register
#define IL __inline__ __attribute__((always_inline))
#define For(i, a, b) for(RG int i = a, ___u = b; i <= ___u; ++i)
#define Dor(i, a, b) for(RG int i = b, ___d = a; i >= ___d; --i)
#define Rep(i, a, b) for(RG int i = a, ___u = b; i != ___u; ++i)
#define dmin(a, b) ((a) < (b) ? (a) : (b))
#define dmax(a, b) ((a) > (b) ? (a) : (b))
#define cmin(a, b) ((a) > (b) ? (a) = (b), 1 : 0)
#define cmax(a, b) ((a) < (b) ? (a) = (b), 1 : 0)
#define diff(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define dabs(i) ((i) > 0 ? (i) : -(i))
typedef long long ll;

namespace pb_ds
{
	// 输入输出优化模板从此开始
	namespace io
	{
		const int MaxBuff = 1 << 15;
		const int Output = 1 << 21;
		char B[MaxBuff], *S = B, *T = B;
		#define getc() ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T) ? 0 : *S++)
		char Out[Output], *iter = Out;
		IL void flush()
		{
			fwrite(Out, 1, iter - Out, stdout);
			iter = Out;
		}
	}

	template<class Type> IL Type read()
	{
		using namespace io;
		RG char ch; RG Type ans = 0; RG bool neg = 0;
		while(ch = getc(), (ch < '0' || ch > '9') && ch != '-')	 ;
		ch == '-' ? neg = 1 : ans = ch - '0';
		while(ch = getc(), '0' <= ch && ch <= '9') ans = ans * 10 + ch - '0';
		return neg ? -ans : ans;
	}
	template<class Type> IL void print(RG Type x, RG char ch = '\n')
	{
		using namespace io;
		if(!x) *iter++ = '0';
		else
		{
			if(x < 0) *iter++ = '-', x = -x;
			static int S2[100]; RG int t = 0;
			while(x) S2[++t] = x % 10, x /= 10;
			while(t) *iter++ = '0' + S2[t--];
		}
		*iter++ = ch;
	}
	// 输入输出优化模板到此结束
#if 1
	const int MaxN = 131072;
	const ll inf = 1000000000000000000ll;
	int N, K, len[MaxN], gas[MaxN];
	ll old[MaxN], add[MaxN];

	struct Pointer{int to; Pointer *next;} *fir[MaxN], mem[MaxN];

	#define SonL (i << 1)
	#define SonR (i << 1 | 1)
	#define RanL l, m
	#define RanR m + 1, r
	#define NeedL ql <= m
	#define NeedR m < qr
	#define Def RG int i, RG int l, RG int r

	namespace Input
	{
		IL void main()
		{
			RG int (*F)() = read<int>;
			N = F(); K = F();
			Rep(i, 1, N) len[i] = F();
			For(i, 1, N) gas[i] = F();
		}
	}

	namespace BuildTree
	{
		ll sum[MaxN];
		int stack[MaxN];

		IL void main()
		{
			Rep(i, 1, N) sum[i] = sum[i - 1] + gas[i] - len[i];
			RG int top = 0, fai; RG ll tmp;
			stack[top] = N;
			stack[++top] = N - 1;
			RG Pointer *tot = mem;
			Dor(i, 1, N - 1)
			{
				tmp = sum[i - 1];
				while(top && tmp < sum[stack[top]]) --top;
				fai = stack[top];
				add[i] = (top ? sum[i - 1] - sum[fai++] : 0);
				stack[++top] = i - 1;
				*++tot = (Pointer) {i, fir[fai]}; fir[fai] = tot;
			}
		}
	}

	struct Data
	{
		ll min_old, max_cur, min_ans, rig_con;
		ll add;
		IL void do_add(RG ll x)
		{
			add += x;
			max_cur += x;
			min_ans += x;
			rig_con += x;
		}
		bool is_leaf;
	}	T[MaxN << 1];

	IL void push_down(RG int i)
	{
		if(T[i].add)
		{
			T[SonL].do_add(T[i].add);
			T[SonR].do_add(T[i].add);
			T[i].add = 0;
		}
	}

	IL ll query_cut(RG int i, RG ll cut)
	{
		RG ll ans = inf;
		while(!T[i].is_leaf && cut < T[i].max_cur)
		{
			push_down(i);
			if(cut <= T[SonL].max_cur)
			{
				cmin(ans, T[i].rig_con);
				i = SonL;
			}
			else
			{
				cmin(ans, cut + T[SonL].min_old);
				i = SonR;
			}
		}
		if(cut < T[i].max_cur) cmin(ans, T[i].min_ans);
		cmin(ans, cut + T[i].min_old);
		return ans;
	}

	IL void push_up(RG int i)
	{
		RG Data *p = T + i;
		if(T[SonL].max_cur >= T[SonR].max_cur)
		{
			p->max_cur = T[SonL].max_cur;
			p->rig_con = T[SonL].max_cur + T[SonR].min_old;
		}
		else
		{
			p->max_cur = T[SonR].max_cur;
			p->rig_con = query_cut(SonR, T[SonL].max_cur);
		}
		p->min_ans = dmin(T[SonL].min_ans, p->rig_con);
	}

	void build(Def)
	{
		if(l == r)
		{
			T[i] = (Data) {-old[l], old[l], inf, inf};
			T[i].is_leaf = 1;
		}
		else
		{
			RG int m = (l + r) >> 1;
			build(SonL, RanL);
			build(SonR, RanR);
			T[i].min_old = dmin(T[SonL].min_old, T[SonR].min_old);
			push_up(i);
		}
	}

	int ql, qr, qp; ll qv, qmax;
	void modify(Def) // [ql, qr] += qv
	{
		if(ql <= l && r <= qr)
			return T[i].do_add(qv);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(NeedL) modify(SonL, RanL);
		if(NeedR) modify(SonR, RanR);
		push_up(i);
	}
	void query_max(Def)
	{
		if(ql <= l && r <= qr)
			return (void) cmax(qmax, T[i].max_cur);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(NeedL) query_max(SonL, RanL);
		if(NeedR) query_max(SonR, RanR);
	}
	void query(Def, RG ll qc)
	{
		if(ql <= l && r <= qr)
		{
			RG ll qv = query_cut(i, qc);
			if(qv > K) {return;}
			if(l == r) {qp = l; return;}
		}
		RG int m = (l + r) >> 1;
		push_down(i);
		// right first
		if(!qp && NeedR)
		{
			if(ql <= l) 		query(SonR, RanR, dmax(qc, T[SonL].max_cur));
			else if(m < ql)		query(SonR, RanR, qc);
			else				{qmax = qc; query_max(SonL, RanL); query(SonR, RanR, qmax);}
		}
		if(!qp && NeedL) 	query(SonL, RanL, qc);
	}

	int ans = 1, out[MaxN];
	void dfs_make(RG int p)
	{
		qmax = -inf;
		ql = qr = p;
		query_max(1, 1, N);
		qp = 0;
		ql = p + 1; qr = N;
		query(1, 1, N, qmax);
		cmax(ans, qp - p + 1);
		out[p] = qp ? qp : p;
		for(RG Pointer *k = fir[p]; k; k = k->next)
		{
			ql = p - 1; qr = N;
			qv = add[k->to];
			modify(1, 1, N);

			dfs_make(k->to);

			ql = p - 1; qr = N;
			qv = -add[k->to];
			modify(1, 1, N);
		}
	}

	IL void main()
	{
		Input::main();
		BuildTree::main();
		For(i, 1, N) old[i] = old[i - 1] + gas[i] - len[i - 1];
		build(1, 1, N);
		dfs_make(N);
		print(ans);
		#ifndef ONLINE_JUDGE
		For(i, 1, N) print(out[i], " \n"[i == N]);
		#endif
	}

#endif
}

int main()
{
	#define FILE "bin"
	// freopen(FILE ".in", "r", stdin); freopen(FILE ".out", "w", stdout);
	pb_ds::main();
	pb_ds::io::flush();
	fclose(stdin); fclose(stdout);
}

#if 0
#endif


// pb_ds big CAT
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;
#define RG register
#define IL __inline__ __attribute__((always_inline))
#define For(i, a, b) for(RG int i = a, ___u = b; i <= ___u; ++i)
#define Dor(i, a, b) for(RG int i = b, ___d = a; i >= ___d; --i)
#define Rep(i, a, b) for(RG int i = a, ___u = b; i != ___u; ++i)
#define dmin(a, b) ((a) < (b) ? (a) : (b))
#define dmax(a, b) ((a) > (b) ? (a) : (b))
#define cmin(a, b) ((a) > (b) ? (a) = (b), 1 : 0)
#define cmax(a, b) ((a) < (b) ? (a) = (b), 1 : 0)
#define diff(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define dabs(i) ((i) > 0 ? (i) : -(i))
typedef long long ll;

namespace pb_ds
{
	// 输入输出优化模板从此开始
	namespace io
	{
		const int MaxBuff = 1 << 15;
		const int Output = 1 << 21;
		char B[MaxBuff], *S = B, *T = B;
		#define getc() ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T) ? 0 : *S++)
		char Out[Output], *iter = Out;
		IL void flush()
		{
			fwrite(Out, 1, iter - Out, stdout);
			iter = Out;
		}
	}

	template<class Type> IL Type read()
	{
		using namespace io;
		RG char ch; RG Type ans = 0; RG bool neg = 0;
		while(ch = getc(), (ch < '0' || ch > '9') && ch != '-')	 ;
		ch == '-' ? neg = 1 : ans = ch - '0';
		while(ch = getc(), '0' <= ch && ch <= '9') ans = ans * 10 + ch - '0';
		return neg ? -ans : ans;
	}
	template<class Type> IL void print(RG Type x, RG char ch = '\n')
	{
		using namespace io;
		if(!x) *iter++ = '0';
		else
		{
			if(x < 0) *iter++ = '-', x = -x;
			static int S2[100]; RG int t = 0;
			while(x) S2[++t] = x % 10, x /= 10;
			while(t) *iter++ = '0' + S2[t--];
		}
		*iter++ = ch;
	}
	// 输入输出优化模板到此结束
#if 1
	const int MaxN = 131072;
	const ll inf = 1000000000000000000ll;
	int N, K, len[MaxN], gas[MaxN];
	ll old[MaxN], add[MaxN];

	struct Pointer{int to; Pointer *next;} *fir[MaxN], mem[MaxN];

	#define SonL (i << 1)
	#define SonR (i << 1 | 1)
	#define RanL l, m
	#define RanR m + 1, r
	#define NeedL ql <= m
	#define NeedR m < qr
	#define Def RG int i, RG int l, RG int r

	namespace Input
	{
		IL void main()
		{
			RG int (*F)() = read<int>;
			N = F(); K = F();
			Rep(i, 1, N) len[i] = F();
			For(i, 1, N) gas[i] = F();
		}
	}

	namespace BuildTree
	{
		ll sum[MaxN];
		int stack[MaxN];

		IL void main()
		{
			Rep(i, 1, N) sum[i] = sum[i - 1] + gas[i] - len[i];
			RG int top = 0, fai; RG ll tmp;
			stack[top] = N;
			stack[++top] = N - 1;
			RG Pointer *tot = mem;
			Dor(i, 1, N - 1)
			{
				tmp = sum[i - 1];
				while(top && tmp < sum[stack[top]]) --top;
				fai = stack[top];
				add[i] = (top ? sum[i - 1] - sum[fai++] : 0);
				stack[++top] = i - 1;
				*++tot = (Pointer) {i, fir[fai]}; fir[fai] = tot;
			}
		}
	}

	struct Data
	{
		ll min_old, max_cur, min_ans, rig_con, min_add;
		ll add;
		IL void do_add(RG ll x)
		{
			add += x;
			max_cur += x;
			min_ans += x;
			rig_con += x;
			min_add += x;
		}
		bool is_leaf;
	}	T[MaxN << 1];

	IL void push_down(RG int i)
	{
		if(T[i].add)
		{
			T[SonL].do_add(T[i].add);
			T[SonR].do_add(T[i].add);
			T[i].add = 0;
		}
	}

	IL ll query_cut(RG int i, RG ll cut)
	{
		RG ll ans = inf;
		while(!T[i].is_leaf && cut < T[i].max_cur)
		{
			push_down(i);
			if(cut <= T[SonL].max_cur)
			{
				cmin(ans, T[i].rig_con);
				i = SonL;
			}
			else
			{
				cmin(ans, cut + T[SonL].min_old);
				i = SonR;
			}
		}
		if(cut < T[i].max_cur) cmin(ans, T[i].min_ans);
		cmin(ans, cut + T[i].min_old);
		return ans;
	}

	IL void push_up(RG int i)
	{
		RG Data *p = T + i;
		if(T[SonL].max_cur >= T[SonR].max_cur)
		{
			p->max_cur = T[SonL].max_cur;
			p->rig_con = T[SonL].max_cur + T[SonR].min_old;
		}
		else
		{
			p->max_cur = T[SonR].max_cur;
			p->rig_con = query_cut(SonR, T[SonL].max_cur);
		}
		p->min_add = dmin(T[SonL].min_add, T[SonR].min_add);
		p->min_ans = dmin(T[SonL].min_ans, p->rig_con);
	}

	void build(Def)
	{
		if(l == r)
		{
			T[i] = (Data) {-old[l], old[l], inf, inf};
			T[i].is_leaf = 1;
		}
		else
		{
			RG int m = (l + r) >> 1;
			build(SonL, RanL);
			build(SonR, RanR);
			T[i].min_old = dmin(T[SonL].min_old, T[SonR].min_old);
			push_up(i);
		}
	}

	int ql, qr, qp; ll qv, qmax;
	void modify(Def) // [ql, qr] += qv
	{
		if(ql <= l && r <= qr)
			return T[i].do_add(qv);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(NeedL) modify(SonL, RanL);
		if(NeedR) modify(SonR, RanR);
		push_up(i);
	}
	void query_max(Def)
	{
		if(ql <= l && r <= qr)
			return (void) cmax(qmax, T[i].max_cur);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(NeedL) query_max(SonL, RanL);
		if(NeedR) query_max(SonR, RanR);
	}
	void find(Def)
	{
		if(qp || T[i].min_add > K) return;
		if(l == r) return (void) (qp = l);
		RG int m = (l + r) >> 1;
		push_down(i);
		if(!qp && NeedR) find(SonR, RanR);
		if(!qp && NeedL) find(SonL, RanL);
	}
	void query(Def, RG ll qc)
	{
		if(ql <= l && r <= qr)
		{
			RG ll qv = query_cut(i, qc);
			if(qv > K) {return;}
			if(l == r) {qp = l; return;}
		}
		RG int m = (l + r) >> 1;
		push_down(i);
		// right first
		if(!qp && NeedR)
		{
			if(ql <= l) 		query(SonR, RanR, dmax(qc, T[SonL].max_cur));
			else if(m < ql)		query(SonR, RanR, qc);
			else				{qmax = qc; query_max(SonL, RanL); query(SonR, RanR, qmax);}
		}
		if(!qp && NeedL) 	query(SonL, RanL, qc);
	}

	int ans = 1, out[MaxN];
	void dfs_make(RG int p)
	{
		ql = qr = p; qmax = -inf;
		query_max(1, 1, N);

		ql = p; qr = N; qp = 0;
		find(1, 1, N);

		if(qp && p != N)
		{
			ql = p + 1; qr = qp + 1; qp = 0;
			query(1, 1, N, qmax);
			cmax(ans, qp - p + 1);
		}
		out[p] = qp ? qp : p;
		for(RG Pointer *k = fir[p]; k; k = k->next)
		{
			ql = p - 1; qr = N;
			qv = add[k->to];
			modify(1, 1, N);

			dfs_make(k->to);

			ql = p - 1; qr = N;
			qv = -add[k->to];
			modify(1, 1, N);
		}
	}

	IL void main()
	{
		Input::main();
		BuildTree::main();
		For(i, 1, N) old[i] = old[i - 1] + gas[i] - len[i - 1];
		build(1, 1, N);
		dfs_make(N);
		print(ans);
		#ifndef ONLINE_JUDGE
		For(i, 1, N) print(out[i], " \n"[i == N]);
		#endif
	}

#endif
}

int main()
{
	#define FILE "bin"
	// freopen(FILE ".in", "r", stdin); freopen(FILE ".out", "w", stdout);
	pb_ds::main();
	pb_ds::io::flush();
	fclose(stdin); fclose(stdout);
}

#if 0
#endif


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

struct Node
{
	long long maxsuf, minr, mindt, p;
}nodes[400005];

struct Edge
{
	int to, next;
	long long v;
}edges[200005];

int pos[100005], ans = 0;
int n, first[100005], te = 0, k;
int w[100005], g[100005], ord[100005];
long long suf[100005], pre[100005];
set <int > s;

bool cmp (int a, int b)
{
	if (pre[a] == pre[b])	return a < b;
	return pre[a] < pre[b];
}

void addE (int a, int b, long long c)
{
//	cout << a << " " << b << " " << c << endl;
	edges[++te].to = b;
	edges[te].next = first[a];
	edges[te].v = c;
	first[a] = te;
}

void add (int x, long long y)
{
	nodes[x].maxsuf += y;
	nodes[x].minr += y;
	nodes[x].p += y;
}

void down (int x)
{
	if (nodes[x].p)
	{
		add (x<<1, nodes[x].p);
		add (x<<1|1, nodes[x].p);
		nodes[x].p = 0;
	}
}

long long calc (int x, int l, int r, long long mx)
{
	if (l == r)
		return nodes[x].mindt + mx;
	down (x);
	int mid = l + r >> 1;
	if (mx > nodes[x<<1].maxsuf)
		return min (nodes[x<<1].mindt + mx, calc (x<<1|1, mid+1, r, mx));
	return min (calc (x<<1, l, mid, mx), nodes[x].minr);
}

void update (int x, int l, int r)
{
	nodes[x].maxsuf = max (nodes[x<<1].maxsuf, nodes[x<<1|1].maxsuf);
	nodes[x].mindt = min (nodes[x<<1].mindt, nodes[x<<1|1].mindt);
	down (x);
	int mid = l + r >> 1;
	nodes[x].minr = calc (x<<1|1, mid+1, r, nodes[x].maxsuf);
}

void build (int x, int l, int r)
{
	if (l == r)
	{
		nodes[x].maxsuf = suf[l];
		nodes[x].mindt = -suf[l];
		nodes[x].minr = nodes[x].p = 0;
		pos[l] = x;
		return ;
	}
	int mid = l + r >> 1;
	build (x<<1, l, mid);
	build (x<<1|1, mid+1, r);
	update (x, l, r);
}

void modify (int x, int st, int ed, int l, int r, long long d)
{
	if (l >= st && r <= ed)
	{
		add (x, d);
		return ;
	}
	down (x);
	int mid = l + r >> 1;
	if (mid >= st)
		modify (x<<1, st, ed, l, mid, d);
	if (mid < ed)
		modify (x<<1|1, st, ed, mid+1, r, d);
	update (x, l, r);
}

long long maxl;

int query (int x, int st, int ed, int l, int r, long long mx)
{
//	cout << x << " " << st << " " << ed << " " << l << " " << r << " " << mx << " " << maxl << endl;
	if (st <= l && r <= ed)
	{
		maxl = max (maxl, nodes[x].maxsuf);
		if (l == r)
			return (mx + nodes[x].mindt <= k) ? l : 0;
		down (x);
		int mid = l + r >> 1;
		if (calc (x<<1|1, mid+1, r, max (mx, nodes[x<<1].maxsuf)) <= k)
			return query (x<<1|1, st, ed, mid+1, r, max (mx, nodes[x<<1].maxsuf));
		return query (x<<1, st, ed, l, mid, mx);
	}
	down (x);
	int mid = l + r >> 1;
	int ret = -1e9;
	if (mid >= st)
		ret = max (ret, query (x<<1, st, ed, l, mid, mx));
	if (mid < ed)
		ret = max (ret, query (x<<1|1, st, ed, mid+1, r, max (mx, maxl)));
	return ret;
}

long long getp (int x)
{
	long long ret = 0;
	int tot = pos[x];
	while (tot)
	{
		ret += nodes[tot].p;
		tot >>= 1;
	}
	return ret;
}

int Binary (int l, int r)
{
	while (l != r)
	{
		int mid = (l + r + 1) >> 1;
		if (getp (mid-1) <= k)
			l = mid;
		else
			r = mid-1;
	}
	return l;
}

void dfs (int x)
{
	if (x != n+1)
	{
		maxl = -1e18;
	//	cout << Binary (x, n) << endl;
		ans = max (ans, query (1, x, Binary (x, n), 1, n, -1e18) - x + 1);
	//	cout << x << " " << ans << endl;
	}
	for (int e = first[x]; e; e = edges[e].next)
	{
		int to = edges[e].to;
		modify (1, x-1, n, 1, n, edges[e].v);
		dfs (to);
		modify (1, x-1, n, 1, n, -edges[e].v);
	}
}

int main ()
{
//	freopen ("plan.out", "w", stdout);
	scanf ("%d%d", &n, &k);
	for (int i = 1; i < n; ++i)
		scanf ("%d", w+i);
	for (int i = 1; i <= n; ++i)
	{
		scanf ("%d", g+i);
		ord[i] = i;
	}
	for (int i = 2; i <= n; ++i)
	{
		suf[i] = suf[i-1] + g[i] - w[i-1];
		pre[i] = pre[i-1] + g[i-1] - w[i-1];
	}
//	for (int i = 1; i <= n; ++i)
//		cout << suf[i] << " " << pre[i] << endl;
	sort (ord+1, ord+n+1, cmp);
	s.insert (n+1);
	for (int i = 1; i <= n; ++i)
	{
		int x = ord[i];
		int find = *s.upper_bound (x);
		long long v = pre[x] - pre[find];
		if (find == n + 1)
			v = 0;
		addE (find, x, v);
		s.insert (x);
	}
	build (1, 1, n);
//	cout << nodes[pos[7]].maxsuf << endl;
	dfs (n+1);
	printf ("%d\n", ans);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<set>
#define N 100005
#define Pii pair<ll, int>
#define fi first
#define se second
#define mk make_pair
using namespace std;
typedef long long ll;
inline int read(){
	int sum = 0, t = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ sum = sum * 10 + ch - '0'; ch = getchar(); }
	return sum * t;
}

int n, k, w[N], g[N];
int nxt[N], fir[N], to[N], cnt;
ll pre[N], suf[N], Mx_Lf, Sm, cst[N];
Pii h[N];
set<int>F;

void add(int x, int y, ll z){
	nxt[++cnt] = fir[x]; to[cnt] = y; fir[x] = cnt; cst[cnt] = z;
}

struct segment{
	struct node{
		ll Mn, Max, tag, Mn_rv;
		void upd(ll v){
			Max += v;
			tag += v;
			Mn_rv += v;
		}
	}tr[N<<2];
	#define ls ri << 1
	#define rs ri << 1 | 1
	#define mid (l + r >> 1)
	#define to_l ls, l, mid
	#define to_r rs, mid + 1, r

	void push(int ri){
		if(tr[ri].tag){
			tr[ls].upd(tr[ri].tag);
			tr[rs].upd(tr[ri].tag);
			tr[ri].tag = 0;
		}
	}

	ll calc(int ri, int l, int r, ll Max){
		if(l == r) return Max + tr[ri].Mn;
		push(ri);
		if(Max > tr[ls].Max) return min(Max + tr[ls].Mn, calc(to_r, Max));
		else return min(calc(to_l, Max), tr[ri].Mn_rv);
	}

	void relax(int ri, int l, int r){
		tr[ri].Mn = min(tr[ls].Mn, tr[rs].Mn);
		tr[ri].Max = max(tr[ls].Max, tr[rs].Max);
		tr[ri].Mn_rv = calc(to_r, tr[ls].Max);
	}

	void build(int ri, int l, int r){
		if(l == r){
			tr[ri].Mn = -suf[l];
			tr[ri].Max = suf[l];
			return ;
		}
		build(to_l); build(to_r);
		relax(ri, l, r);
	}

	void modify(int ri, int l, int r, int L, int R, ll dt){
		if(l >= L && r <= R) return tr[ri].upd(dt);
		push(ri);
		if(L <= mid) modify(to_l, L, R, dt);
		if(R > mid) modify(to_r, L, R, dt);
		relax(ri, l, r);
	}

	int query(int ri, int l, int r, int L, int R, ll Max){
		if(l >= L && r <= R){
			Mx_Lf = max(Mx_Lf, tr[ri].Max);
			if(l == r){
				if(Max + tr[ri].Mn <= k) return l;
				return 0;
			}
			if(calc(to_r, max(Max, tr[ls].Max)) <= k) return query(to_r, L, R, max(Max, tr[ls].Max));
			 return query(to_l, L, R, Max);
		}
		push(ri);
		if(R <= mid) return query(to_l, L, R, Max);
		if(L > mid) return query(to_r, L, R, Max);
		int res = query(to_l, L, R, Max);
		res = max(res, query(to_r, L, R, max(Mx_Lf, Max)));
		return res;
	}

	ll fuck(int ri, int l, int r, int pos){
		if(l == r) return tr[ri].tag;
		push(ri);
		if(pos <= mid) return tr[ri].tag + fuck(to_l, pos);
		else return tr[ri].tag + fuck(to_r, pos);
	}

	int ask(int l, int r){
		while(l < r){
			int Mid = l + r + 1 >> 1;
			if(fuck(1, 1, n, mid - 1) <= k) l = Mid;
			else r = Mid - 1;
		}
		return l;
	}
}S;

int ans;

void dfs(int x){
	if(x <= n){
		Mx_Lf = -1LL << 60; Sm = 0;
		ans = max(ans, S.query(1, 1, n, x, S.ask(x, n), -1LL << 60) - x + 1);
	}
	for(int i = fir[x]; i ; i = nxt[i]){
		int y = to[i];
		S.modify(1, 1, n, x - 1, n, cst[i]);
		dfs(y);
		S.modify(1, 1, n, x - 1, n, -cst[i]);
	}
}

int main(){
	n = read(); k = read();
	for(int i = 1; i < n; i++) w[i] = read();
	for(int i = 1; i <= n; i++) g[i] = read();
	for(int i = 2; i <= n; i++) pre[i] = pre[i - 1] + g[i - 1] - w[i - 1];
	for(int i = 1; i <= n; i++) h[i] = mk(pre[i], i);
	for(int i = 2; i <= n; i++) suf[i] = suf[i - 1] + g[i] - w[i - 1];
	sort(h + 1, h + n + 1);
	F.insert(n + 1);
	for(int i = 1, j = 1; i <= n; i++){
		int x = h[i].se, y = *F.upper_bound(h[i].se);
		ll cost = pre[x] - pre[y];
		if(y == n + 1) cost = 0;
		add(y, x, cost);
		for(; h[i + 1].fi != h[j].fi && i < n & j <= n; j++)
			F.insert(h[j].se);
	}
	S.build(1, 1, n);
	dfs(n + 1);
	printf("%d\n", ans);
}


#include<cstdio>
#define L 1<<23
#define C (c=*A++)
#define ENS //__attribute__((optimize("-O2")))
#define NES //__attribute__((optimize("-O2"))) __inline__ __attribute__((always_inline))
#define N 100007
#define T 262144

struct edge{int v,w;edge *nt;}G[N],*e[N],*v=G;
int n,k,MAPLE=1,lm,rm,fin,ri[N],pos,d[N],a[N],wt,ss[19];char fl[L],*A=fl;long long fint,w[N],s[N],mpos;bool u[N];
struct node{long long mx,mi,h,mp,mc;node *l,*r;int fg;int le,ri,mid;
	NES long long min(long long a,long long b){return a>b?b:a;}
	NES void pd(long long tmp){mx+=tmp,mi+=tmp,h+=tmp,mc+=tmp;}
	NES long long dfs(long long tmp)
	{
		if(tmp>mx||le==ri)return tmp+mp;if(h)l->pd(h),r->pd(h),h=0;
		if(l->mx<tmp)return min(tmp+l->mp,r->dfs(tmp));else return min(l->dfs(tmp),mi);
	}
	NES int vfs(){if(le==ri)return le;if(h)l->pd(h),r->pd(h),h=0;return r->mc<=k?r->vfs():l->vfs();}
	NES void query()
	{
		if(lm<=le&&ri<=rm){if(dfs(fint)<=k)pos=fg,mpos=fint;if(mx>fint)fint=mx;return;}
		if(h)l->pd(h),r->pd(h),h=0;if(lm<=mid)l->query();if(mid<rm)r->query();
	}
	NES void fix(){mx=l->mx>r->mx?l->mx:r->mx,mc=l->mc,mi=r->dfs(l->mx);}
	NES void alter()
	{
		if(lm<=le)return (void)pd(fin);if(h)l->pd(h),r->pd(h),h=0;
		if(lm<=mid)l->alter();r->alter();fix();
	}
	NES int qfs(long long fint)
	{
		if(le==ri)return le;if(h)l->pd(h),r->pd(h),h=0;
		if(r->dfs(l->mx>fint?l->mx:fint)<=k)return r->qfs(l->mx>fint?l->mx:fint);return l->qfs(fint);
	}
}t[T],*root,*cnt=t;
NES void read(int&x){char c;for(x=0;'0'>C||c>'9';);while('0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,C;}NES void print(int x){if(!x)putchar(48);else{for(wt=0;x;ss[++wt]=x%10,x/=10);for(;wt;putchar(ss[wt--]+48));}}
NES void build(node *&x,int le,int ri)
{
	if(x=++cnt,x->fg=cnt-t,x->le=le,x->ri=ri,le==ri)return (void)(s[le]=s[le-1]+a[le]-d[le-1],x->mx=s[le],x->mp=-s[le]);int mid=(le+ri)>>1;
	x->mid=mid,build(x->l,le,mid),build(x->r,mid+1,ri),x->fix();x->mp=x->l->mp<x->r->mp?x->l->mp:x->r->mp;
}
NES void dfs(int x)
{int tmp=root->vfs();if((++tmp)>n)tmp=n;
	if(x!=tmp&&(fint=s[x],lm=x+1,rm=tmp,pos=0,root->query(),pos&&(tmp=t[pos].qfs(mpos),tmp-x+1>MAPLE)))MAPLE=tmp-x+1;
	for(edge *v=e[x];v;lm=x-1,fin=v->w,root->alter(),s[lm]+=fin,dfs(v->v),lm=x-1,fin=-v->w,root->alter(),s[lm]+=fin,v=v->nt);
}
ENS int main()
{int i,j;long long tmp;
	for(*(fl+fread(fl,1,L,stdin))=EOF,read(n),read(k),i=1;i<n;read(d[i++]));for(i=1;i<=n;read(a[i]),w[i]=w[i-1]+a[i]-d[i],i++);
	for(build(root,1,n),w[n+1]=-1ll<<51,u[n]=true,ri[n]=n+1,i=n-1;~i;i--)
	{
		for(j=i+1;w[j]>=w[i];j=ri[j]);ri[i]=j;
		if(ri[i]<n)(++v)->v=i+1,v->nt=e[ri[i]+1],e[ri[i]+1]=v,v->w=w[i]-w[ri[i]];else u[i+1]=true;
	}for(i=1;i<=n;i++)if(u[i])dfs(i);print(MAPLE);
}


#include<cstdio>
#define L 1<<23
#define C (c=*A++)
#define ENS //__attribute__((optimize("-O2")))
#define NES //__attribute__((optimize("-O2"))) __inline__ __attribute__((always_inline))
#define N 100007
#define T 262144

struct edge{int v,w;edge *nt;}G[N],*e[N],*v=G;
int n,k,MAPLE,lm,rm,fin,ri[N],pos,d[N],a[N],wt,ss[19];char fl[L],*A=fl;long long fint,w[N],s[N],mpos;bool u[N];
struct node{long long mx,mi,h,mp,mc;node *l,*r;int fg;int le,ri,mid;
	NES long long min(long long a,long long b){return a>b?b:a;}
	NES void pd(long long tmp){mx+=tmp,mi+=tmp,h+=tmp,mc+=tmp;}
	NES long long dfs(long long tmp)
	{
		if(tmp>mx||le==ri)return tmp+mp;if(h)l->pd(h),r->pd(h),h=0;
		if(l->mx<tmp)return min(tmp+l->mp,r->dfs(tmp));else return min(l->dfs(tmp),mi);
	}
	NES int vfs(){if(le==ri)return le;if(h)l->pd(h),r->pd(h),h=0;return r->mc<=k?r->vfs():l->vfs();}
	NES void query()
	{
		if(lm<=le&&ri<=rm){if(dfs(fint)<=k)pos=fg,mpos=fint;if(mx>fint)fint=mx;return;}
		if(h)l->pd(h),r->pd(h),h=0;if(lm<=mid)l->query();if(mid<rm)r->query();
	}
	NES void fix(){mx=l->mx>r->mx?l->mx:r->mx,mc=l->mc,mi=r->dfs(l->mx);}
	NES void alter()
	{
		if(lm<=le)return (void)pd(fin);if(h)l->pd(h),r->pd(h),h=0;
		if(lm<=mid)l->alter();r->alter();fix();
	}
	NES int qfs(long long fint)
	{
		if(le==ri)return le;if(h)l->pd(h),r->pd(h),h=0;
		if(r->dfs(l->mx>fint?l->mx:fint)<=k)return r->qfs(l->mx>fint?l->mx:fint);return l->qfs(fint);
	}
}t[T],*root,*cnt=t;
NES void read(int&x){char c;for(x=0;'0'>C||c>'9';);while('0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,C;}NES void print(int x){if(!x)putchar(48);else{for(wt=0;x;ss[++wt]=x%10,x/=10);for(;wt;putchar(ss[wt--]+48));}}
NES void build(node *&x,int le,int ri)
{
	if(x=++cnt,x->fg=cnt-t,x->le=le,x->ri=ri,le==ri)return (void)(s[le]=s[le-1]+a[le]-d[le-1],x->mx=s[le],x->mp=-s[le]);int mid=(le+ri)>>1;
	x->mid=mid,build(x->l,le,mid),build(x->r,mid+1,ri),x->fix();x->mp=x->l->mp<x->r->mp?x->l->mp:x->r->mp;
}
NES void dfs(int x)
{int tmp=root->vfs();if((++tmp)>n)tmp=n;
	if(x!=tmp&&(fint=s[x],lm=x+1,rm=tmp,pos=0,root->query(),pos&&(tmp=t[pos].qfs(mpos),tmp-x+1>MAPLE)))MAPLE=tmp-x+1;
	for(edge *v=e[x];v;lm=x-1,fin=v->w,root->alter(),s[lm]+=fin,dfs(v->v),lm=x-1,fin=-v->w,root->alter(),s[lm]+=fin,v=v->nt);
}
ENS int main()
{int i,j;long long tmp;
	for(*(fl+fread(fl,1,L,stdin))=EOF,read(n),read(k),i=1;i<n;read(d[i++]));for(i=1;i<=n;read(a[i]),w[i]=w[i-1]+a[i]-d[i],i++);
	for(build(root,1,n),w[n+1]=-1ll<<51,u[n]=true,ri[n]=n+1,i=n-1;~i;i--)
	{
		for(j=i+1;w[j]>=w[i];j=ri[j]);ri[i]=j;
		if(ri[i]<n)(++v)->v=i+1,v->nt=e[ri[i]+1],e[ri[i]+1]=v,v->w=w[i]-w[ri[i]];else u[i+1]=true;
	}for(i=1;i<=n;i++)if(u[i])dfs(i);print(MAPLE);
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return calc (o, l, r, md) >= -K? l : -1;
	push (o);
	int mid (l + r >> 1);
	if (L <= l && r <= R)
		if (calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K)
			return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
		else
			return query (ls (o), l, mid, L, R);
	if (R <= mid)
		return query (ls (o), l, mid, L, R);
	if (L > mid)
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	ll nd = md; md = max (a[ls (o)].md, md);
	int t = query (rs (o), mid + 1, r, L, R);
	return t > -1? t : (md = nd, query (ls (o), l, mid, L, R));
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r + 1 >> 1, l < r;)
		if (sum - pre[mid - 1] > K)
			l = mid;
		else
			r = mid - 1;
	return l? stk[l] : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n) {
			int t = query (1, 1, n, i, get()) - i + 1;
			ans = max (t, ans);
		}
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r >> 1, l < r;)
		if (sum - pre[mid] <= K)
			r = mid;
		else
			l = mid + 1;
	return l? stk[l] - 1 : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n)
			ans = max (query (1, 1, n, i, get()) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], top, stk[N], ans = 1;
ll s[N], md;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[ stk[top] ]);
					d -= t, val[ stk[top] ] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[ stk[top] ]) break;
				}
			else if (d < 0)
				top ++, stk[top] = i, val[i] = -d, modify (1, 1, n, i, n, -d);
		if (i < n)
			ans = max (query (1, 1, n, i, n) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r + 1 >> 1, l < r;)
		if (sum - pre[mid - 1] > K)
			l = mid;
		else
			r = mid - 1;
	return l? stk[l] - 1 : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n)
			ans = max (query (1, 1, n, i, get()) - i + 1, ans);
		//ans = max (query (1, 1, n, i, n) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r >> 1, l < r;)
		if (sum - pre[mid] > K)
			r = mid;
		else
			l = mid + 1;
	return l? stk[l] - 1 : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n)
			ans = max (query (1, 1, n, i, get()) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], top, stk[N], ans = 1;
ll s[N], md;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, int d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[ stk[top] ]);
					d -= t, val[ stk[top] ] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[ stk[top] ]) break;
				}
			else if (d < 0)
				top ++, stk[top] = i, val[i] = -d, modify (1, 1, n, i, n, -d);
		if (i < n)
			ans = max (query (1, 1, n, i, n) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r + 1 >> 1, l < r;)
		if (sum - pre[mid] > K)
			l = mid;
		else
			r = mid - 1;
	return l? stk[l] - 1 : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n)
			ans = max (query (1, 1, n, i, get()) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;

#define LY(p) freopen (p".in", "r", stdin); freopen (p".out", "w", stdout)
#define dbl double
#define ll long long
#define ld long double
#ifdef WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define PII pair<int, int>

const int N = 1e5 + 10;
const ll inf = 1e15;

int n, K, w[N], g[N], val[N], stk[N], top, p, ans = 1;
ll s[N], pre[N], md, sum;

#define ls(o) ((o) << 1)
#define rs(o) (ls (o) | 1)

struct node {
	ll md, ms, mv, rv, add;

	node(): md(-inf), ms(-inf), mv(-inf), rv(-inf), add(0) {}
} a[N * 4];

void add (int o, ll d) {
	a[o].md += d, a[o].mv -= d, a[o].rv -= d, a[o].add += d;
}

void push (int o) {
	if (a[o].add) {
		add (ls (o), a[o].add);
		add (rs (o), a[o].add);
		a[o].add = 0;
	}
}

ll calc (int o, int l, int r, ll x) {
	if (l == r)
		return a[o].ms - x;
	push (o);
	int mid (l + r >> 1);
	if (x < a[ls (o)].md)
		return max (calc (ls (o), l, mid, x), a[o].rv);
	else
		return max (calc (rs (o), mid + 1, r, x), a[ls (o)].ms - x);
}

void update (int o, int l, int r) {
	int mid (l + r >> 1);
	a[o].md = max (a[ls (o)].md, a[rs (o)].md);
	a[o].ms = max (a[ls (o)].ms, a[rs (o)].ms);
	a[o].rv = calc (rs (o), mid + 1, r, a[ls (o)].md);
	a[o].mv = max (a[ls (o)].mv, a[o].rv);
}

void modify (int o, int l, int r, int L, int R, int d) {
	if (R < l || r < L) return;
	if (L <= l && r <= R)
		return add (o, d);
	push (o);
	int mid (l + r >> 1);
	modify (ls (o), l, mid, L, R, d);
	modify (rs (o), mid + 1, r, L, R, d);
	update (o, l, r);
}

void modify (int o, int l, int r, int x) {
	if (l == r)
		return (void) (a[o].md = a[o].ms = s[l], a[o].mv = 0);
	push (o);
	int mid (l + r >> 1);
	if (x <= mid)
		modify (ls (o), l, mid, x);
	else
		modify (rs (o), mid + 1, r, x);
	update (o, l, r);
}

int query (int o, int l, int r, int L, int R) {
	if (o == 1)	md = -inf;
	if (R < l || r < L) return -1;
	if (l == r) return l;
	push (o);
	int mid (l + r >> 1);
	if (L > mid || (R > mid && calc (rs (o), mid + 1, r, max (md, a[ls (o)].md)) >= -K))
		return md = max (a[ls (o)].md, md), query (rs (o), mid + 1, r, L, R);
	else
		return query (ls (o), l, mid, L, R);
}

int get() {
	if (! top) return n;
	int l = 0, r = top;
	for (int mid; mid = l + r + 1 >> 1, l < r;)
		if (sum - pre[mid - 1] > K)
			l = mid;
		else
			r = mid - 1;
	return l? stk[l] : n;
}

int main()
{
#ifndef ONLINE_JUDGE
	LY("E");
#endif
	scanf ("%d %d", &n, &K);
	for (int i = 1; i < n; i++) scanf ("%d", w + i);
	for (int i = 1; i <= n; i++) scanf ("%d", g + i);
	for (int i = 1; i <= n; i++)
		s[i] = s[i - 1] + g[i] - w[i - 1];

	for (int i = n, d; i >= 1; i--) {
		modify (1, 1, n, i);
		if (i < n)
			if ((d = g[i] - w[i]) > 0)
				for (int t; d && top; top--) {
					t = min (d, val[top]);
					d -= t, val[top] -= t;
					modify (1, 1, n, stk[top], n, -t);
					if (val[top]) break;
				}
			else if (d < 0)
				stk[++ top] = i, val[top] = -d, modify (1, 1, n, i, n, -d);
		sum = pre[top] = pre[top - 1] + val[top];
		if (i < n)
			ans = max (query (1, 1, n, i, get()) - i + 1, ans);
	}
	printf ("%d", ans);
	return 0;
}


#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef double db;
typedef long long ll;
typedef vector<int> VI;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

const ll inf=1ll<<60;
const int N=100000+18;

int head[N],cnt,nn;
struct Seg { int o,l,r; }P[35];
struct Edge { int to,nxt; }E[N];
struct Info { int pos; ll val; };
struct Tree { Info ind1,ind2; ll mx,tag,cost; }s[N<<2];

#define mid (l+r>>1)
Info min(Info x,Info y) { return x.val<y.val?x:y; }

int n,K,ans,a[N],nxt[N];
ll d[N],pre[N],suf[N],ned[N],t;

void pushdown(int o) {
	if (!s[o].tag) return;
	s[o<<1  ].mx+=s[o].tag,s[o<<1  ].tag+=s[o].tag,s[o<<1  ].cost+=s[o].tag;
	s[o<<1|1].mx+=s[o].tag,s[o<<1|1].tag+=s[o].tag,s[o<<1|1].cost+=s[o].tag;
	s[o].tag=0;
}

Info calc(int o,int l,int r) {
	Info Ret;
	if (l==r) {
		Ret.pos=l;
		if (t==-inf) Ret.val=inf;
		else Ret.val=t+s[o].ind1.val;
		return Ret;
	}
	pushdown(o);
	if (s[o<<1].mx>t)
		return min(calc(o<<1,l,mid),s[o<<1|1].ind2);

	Ret=(Info){s[o<<1].ind1.pos,s[o<<1].ind1.val+t};
	return min(Ret,calc(o<<1|1,mid+1,r));
}

void pushup(int o,int l,int r) {
	s[o].mx=max(s[o<<1].mx,s[o<<1|1].mx);
	s[o].ind1=min(s[o<<1].ind1,s[o<<1|1].ind1);
	s[o].cost=min(s[o<<1].cost,s[o<<1|1].cost);
	t=s[o<<1].mx,s[o].ind2=calc(o<<1|1,mid+1,r); return;
}

void build(int o,int l,int r) {
	if (l==r) {
		s[o].mx=suf[l];
		s[o].ind1=(Info){l,-suf[l]}; return;
	}
	build(o<<1,l,mid);
	build(o<<1|1,mid+1,r);
	pushup(o,l,r);
}

int find(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o);
	if (s[o<<1|1].cost<=K) return find(o<<1|1,mid+1,r);
	return find(o<<1,l,mid);
}

void modify(int o,int l,int r,int x,int y,ll val) {
	if (l==x && r==y) {
		s[o].mx+=val;
		s[o].tag+=val;
		s[o].cost+=val; return;
	}
	pushdown(o);
	if (y<=mid) modify(o<<1,l,mid,x,y,val);
	else if (x>mid) modify(o<<1|1,mid+1,r,x,y,val);
	else modify(o<<1,l,mid,x,mid,val),modify(o<<1|1,mid+1,r,mid+1,y,val);
	pushup(o,l,r);
}

void query(int o,int l,int r,int x,int y) {
	if (l==x && r==y) { P[++nn]=(Seg){o,l,r}; return; }
	pushdown(o);
	if (y<=mid) query(o<<1,l,mid,x,y);
	else if (x>mid) query(o<<1|1,mid+1,r,x,y);
	else query(o<<1,l,mid,x,mid),query(o<<1|1,mid+1,r,mid+1,y);
}

int right(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o); ll tmp=t;

	t=max(t,s[o<<1].mx);
	if (calc(o<<1|1,mid+1,r).val<=K)
		return right(o<<1|1,mid+1,r);

	t=tmp;
	return right(o<<1,l,mid);
}

int getans() {
	static ll mx[35]; mx[0]=-inf;
	For (i,1,nn) mx[i]=max(mx[i-1],s[P[i].o].mx);
	int Ret=0;

	while (nn) {
		t=mx[nn-1];
		if (calc(P[nn].o,P[nn].l,P[nn].r).val<=K)
			Ret=right(P[nn].o,P[nn].l,P[nn].r),nn=1;
		nn--;
	}
	return Ret;
}

void dfs(int l) {
	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,ned[l]);

	int tmp;
	if (s[1].cost>K) tmp=0; else tmp=find(1,1,n);
	if (tmp==n) tmp=n-1;
	query(1,1,n,l,tmp+1);

	tmp=getans();
	if (tmp-l+1>ans) ans=tmp-l+1;
	Rep (i,l) dfs(E[i].to);

	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,-ned[l]);
}

int main() {

	n=rd(),K=rd();
	For (i,1,n-1) d[i]=rd();
	For (i,1,n) a[i]=rd();
	For (i,2,n) pre[i]=pre[i-1]+a[i-1]-d[i-1];
	For (i,2,n) suf[i]=suf[i-1]+a[i  ]-d[i-1];

	Dep (i,n,1) {
		nxt[i]=i+1;
		while (nxt[i]<=n && -(pre[nxt[i]]-pre[i])<=0)
			nxt[i]=nxt[nxt[i]];
		if (nxt[i]!=n+1) {
			ned[i]=-(pre[nxt[i]]-pre[i]);
			E[++cnt]=(Edge){i,head[nxt[i]]}; head[nxt[i]]=cnt;
		}
	}

	build(1,1,n);
	For (i,1,n) if (nxt[i]==n+1)
		dfs(i);

	printf("%d\n",ans);
	return 0;
}

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

*/


#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef double db;
typedef long long ll;
typedef vector<int> VI;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

const ll inf=1ll<<60;
const int N=100000+18;

int head[N],cnt,nn;
struct Seg { int o,l,r; }P[35];
struct Edge { int to,nxt; }E[N];
struct Info { int pos; ll val; };
struct Tree { Info ind1,ind2; ll mx,tag,cost; }s[N<<2];

#define mid (l+r>>1)
Info min(Info x,Info y) { return x.val<y.val?x:y; }

int n,K,ans=1,a[N],nxt[N];
ll d[N],pre[N],suf[N],ned[N],t;

void pushdown(int o) {
	if (!s[o].tag) return;
	s[o<<1  ].mx+=s[o].tag,s[o<<1  ].tag+=s[o].tag,s[o<<1  ].cost+=s[o].tag;
	s[o<<1|1].mx+=s[o].tag,s[o<<1|1].tag+=s[o].tag,s[o<<1|1].cost+=s[o].tag;
	s[o].tag=0;
}

Info calc(int o,int l,int r) {
	Info Ret;
	if (l==r) {
		Ret.pos=l;
		if (t==-inf) Ret.val=inf;
		else Ret.val=t+s[o].ind1.val;
		return Ret;
	}
	pushdown(o);
	if (s[o<<1].mx>t)
		return min(calc(o<<1,l,mid),s[o<<1|1].ind2);

	Ret=(Info){s[o<<1].ind1.pos,s[o<<1].ind1.val+t};
	return min(Ret,calc(o<<1|1,mid+1,r));
}

void pushup(int o,int l,int r) {
	s[o].mx=max(s[o<<1].mx,s[o<<1|1].mx);
	s[o].ind1=min(s[o<<1].ind1,s[o<<1|1].ind1);
	s[o].cost=min(s[o<<1].cost,s[o<<1|1].cost);
	t=s[o<<1].mx,s[o].ind2=calc(o<<1|1,mid+1,r); return;
}

void build(int o,int l,int r) {
	if (l==r) {
		s[o].mx=suf[l];
		s[o].ind1=(Info){l,-suf[l]}; return;
	}
	build(o<<1,l,mid);
	build(o<<1|1,mid+1,r);
	pushup(o,l,r);
}

int find(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o);
	if (s[o<<1|1].cost<=K) return find(o<<1|1,mid+1,r);
	return find(o<<1,l,mid);
}

void modify(int o,int l,int r,int x,int y,ll val) {
	if (l==x && r==y) {
		s[o].mx+=val;
		s[o].tag+=val;
		s[o].cost+=val; return;
	}
	pushdown(o);
	if (y<=mid) modify(o<<1,l,mid,x,y,val);
	else if (x>mid) modify(o<<1|1,mid+1,r,x,y,val);
	else modify(o<<1,l,mid,x,mid,val),modify(o<<1|1,mid+1,r,mid+1,y,val);
	pushup(o,l,r);
}

void query(int o,int l,int r,int x,int y) {
	if (l==x && r==y) { P[++nn]=(Seg){o,l,r}; return; }
	pushdown(o);
	if (y<=mid) query(o<<1,l,mid,x,y);
	else if (x>mid) query(o<<1|1,mid+1,r,x,y);
	else query(o<<1,l,mid,x,mid),query(o<<1|1,mid+1,r,mid+1,y);
}

int right(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o); ll tmp=t;

	t=max(t,s[o<<1].mx);
	if (calc(o<<1|1,mid+1,r).val<=K)
		return right(o<<1|1,mid+1,r);

	t=tmp;
	return right(o<<1,l,mid);
}

int getans() {
	static ll mx[35]; mx[0]=-inf;
	For (i,1,nn) mx[i]=max(mx[i-1],s[P[i].o].mx);
	int Ret=0;

	while (nn) {
		t=mx[nn-1];
		if (calc(P[nn].o,P[nn].l,P[nn].r).val<=K)
			Ret=right(P[nn].o,P[nn].l,P[nn].r),nn=1;
		nn--;
	}
	return Ret;
}

void dfs(int l) {
	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,ned[l]);

	int tmp;
	if (s[1].cost>K) tmp=0; else tmp=find(1,1,n);
	if (tmp==n) tmp=n-1;
	query(1,1,n,l,tmp+1);

	tmp=getans();
	if (tmp-l+1>ans) ans=tmp-l+1;
	Rep (i,l) dfs(E[i].to);

	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,-ned[l]);
}

int main() {

	n=rd(),K=rd();
	For (i,1,n-1) d[i]=rd();
	For (i,1,n) a[i]=rd();
	For (i,2,n) pre[i]=pre[i-1]+a[i-1]-d[i-1];
	For (i,2,n) suf[i]=suf[i-1]+a[i  ]-d[i-1];

	Dep (i,n,1) {
		nxt[i]=i+1;
		while (nxt[i]<=n && -(pre[nxt[i]]-pre[i])<=0)
			nxt[i]=nxt[nxt[i]];
		if (nxt[i]!=n+1) {
			ned[i]=-(pre[nxt[i]]-pre[i]);
			E[++cnt]=(Edge){i,head[nxt[i]]}; head[nxt[i]]=cnt;
		}
	}

	build(1,1,n);
	For (i,1,n) if (nxt[i]==n+1)
		dfs(i);

	printf("%d\n",ans);
	return 0;
}

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

*/


#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef double db;
typedef long long ll;
typedef vector<int> VI;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

const ll inf=1ll<<60;
const int N=100000+18;

int head[N],cnt,nn;
struct Seg { int o,l,r; }P[35];
struct Edge { int to,nxt; }E[N];
struct Info { int pos; ll val; };
struct Tree { Info ind1,ind2; ll mx,tag,cost; }s[N<<2];

#define mid (l+r>>1)
Info min(Info x,Info y) { return x.val<y.val?x:y; }

int n,K,ans,a[N],nxt[N];
ll d[N],pre[N],suf[N],ned[N],t;

void pushdown(int o) {
	if (!s[o].tag) return;
	s[o<<1  ].mx+=s[o].tag,s[o<<1  ].tag+=s[o].tag,s[o<<1  ].cost+=s[o].tag;
	s[o<<1|1].mx+=s[o].tag,s[o<<1|1].tag+=s[o].tag,s[o<<1|1].cost+=s[o].tag;
	s[o].tag=0;
}

Info calc(int o,int l,int r) {
	Info Ret;
	if (l==r) {
		Ret.pos=l;
		if (t==-inf) Ret.val=inf;
		else Ret.val=t+s[o].ind1.val;
		return Ret;
	}
	pushdown(o);
	if (s[o<<1].mx>t)
		return min(calc(o<<1,l,mid),s[o<<1|1].ind2);

	Ret=(Info){s[o<<1].ind1.pos,s[o<<1].ind1.val+t};
	return min(Ret,calc(o<<1|1,mid+1,r));
}

void pushup(int o,int l,int r) {
	s[o].mx=max(s[o<<1].mx,s[o<<1|1].mx);
	s[o].ind1=min(s[o<<1].ind1,s[o<<1|1].ind1);
	s[o].cost=s[o<<1].cost;
	t=s[o<<1].mx,s[o].ind2=calc(o<<1|1,mid+1,r); return;
}

void build(int o,int l,int r) {
	if (l==r) {
		s[o].mx=suf[l];
		s[o].ind1=(Info){l,-suf[l]}; return;
	}
	build(o<<1,l,mid);
	build(o<<1|1,mid+1,r);
	pushup(o,l,r);
}

int find(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o);
	if (s[o<<1|1].cost<=K) return find(o<<1|1,mid+1,r);
	return find(o<<1,l,mid);
}

void modify(int o,int l,int r,int x,int y,ll val) {
	if (l==x && r==y) {
		s[o].mx+=val;
		s[o].tag+=val;
		s[o].cost+=val; return;
	}
	pushdown(o);
	if (y<=mid) modify(o<<1,l,mid,x,y,val);
	else if (x>mid) modify(o<<1|1,mid+1,r,x,y,val);
	else modify(o<<1,l,mid,x,mid,val),modify(o<<1|1,mid+1,r,mid+1,y,val);
	pushup(o,l,r);
}

void query(int o,int l,int r,int x,int y) {
	if (l==x && r==y) { P[++nn]=(Seg){o,l,r}; return; }
	pushdown(o);
	if (y<=mid) query(o<<1,l,mid,x,y);
	else if (x>mid) query(o<<1|1,mid+1,r,x,y);
	else query(o<<1,l,mid,x,mid),query(o<<1|1,mid+1,r,mid+1,y);
}

int right(int o,int l,int r) {
	if (l==r) return l;
	pushdown(o); ll tmp=t;

	t=max(t,s[o<<1].mx);
	if (calc(o<<1|1,mid+1,r).val<=K)
		return right(o<<1|1,mid+1,r);

	t=tmp;
	return right(o<<1,l,mid);
}

int getans() {
	static ll mx[35]; mx[0]=-inf;
	For (i,1,nn) mx[i]=max(mx[i-1],s[P[i].o].mx);
	int Ret=0;

	while (nn) {
		t=mx[nn-1];
		if (calc(P[nn].o,P[nn].l,P[nn].r).val<=K)
			Ret=right(P[nn].o,P[nn].l,P[nn].r),nn=1;
		nn--;
	}
	return Ret;
}

void dfs(int l) {
	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,ned[l]);

	int tmp;
	if (s[1].cost>K) tmp=0; else tmp=find(1,1,n);
	if (tmp==n) tmp=n-1;
	query(1,1,n,l,tmp+1);

	tmp=getans();
	if (tmp-l+1>ans) ans=tmp-l+1;
	Rep (i,l) dfs(E[i].to);

	if (nxt[l]!=n+1) modify(1,1,n,nxt[l]-1,n,-ned[l]);
}

int main() {

	n=rd(),K=rd();
	For (i,1,n-1) d[i]=rd();
	For (i,1,n) a[i]=rd();
	For (i,2,n) pre[i]=pre[i-1]+a[i-1]-d[i-1];
	For (i,2,n) suf[i]=suf[i-1]+a[i  ]-d[i-1];

	Dep (i,n,1) {
		nxt[i]=i+1;
		while (nxt[i]<=n && -(pre[nxt[i]]-pre[i])<=0)
			nxt[i]=nxt[nxt[i]];
		if (nxt[i]!=n+1) {
			ned[i]=-(pre[nxt[i]]-pre[i]);
			E[++cnt]=(Edge){i,head[nxt[i]]}; head[nxt[i]]=cnt;
		}
	}

	build(1,1,n);
	For (i,1,n) if (nxt[i]==n+1)
		dfs(i);

	printf("%d\n",ans);
	return 0;
}

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

*/


#include<cstdio>
using namespace std;
typedef long long ll;
const ll oo=1000000000000000000ll;
const int N=100100;
int i,j,k,n,m,K,ch,En,ans,nn;
int nt[N],h[N];
ll t,g[N],w[N],need[N],pre[N],suf[N],cost[N],s[N];
struct dd {int L,R,k;} A[N];
struct edge { int s,n;} E[N];
struct cc { int pos;ll val;};
struct tree { cc ind1,ind2;ll ad,cost,mx;} T[N<<2];
void R(int &x) {
	x=0;ch=getchar();
	while (ch<'0' || '9'<ch) ch=getchar();
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
}
void R(ll &x) {
	x=0;ch=getchar();
	while (ch<'0' || '9'<ch) ch=getchar();
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
}
void E_add(int x,int F) {
	E[++En].s=x;E[En].n=h[F];h[F]=En;
}
cc min(cc x,cc y) {
	if (x.val<y.val) return x;
	return y;
}
int max(int x,int y) {
	if (x>y) return x;
	return y;
}
ll min(ll x,ll y) {
	if (x<y) return x;
	return y;
}
ll max(ll x,ll y) {
	if (x>y) return x;
	return y;
}
void down(int k) {
	if (T[k].ad) {
		T[k<<1].ad+=T[k].ad;
		T[k<<1].cost+=T[k].ad;
		T[k<<1].mx+=T[k].ad;
		T[k<<1|1].ad+=T[k].ad;
		T[k<<1|1].cost+=T[k].ad;
		T[k<<1|1].mx+=T[k].ad;
		T[k].ad=0;
	}
}
cc calc(int L,int R,int k) {
	if (L==R) {
		cc a;
		a.pos=L;
		if (t==-oo) a.val=oo;
		else a.val=t+T[k].ind1.val;
		return a;
	}
	int mid=(L+R)>>1;
	if (t<=T[k<<1].mx) return min(calc(L,mid,k<<1),T[k].ind2);
	cc a;
	a=T[k<<1].ind1;
	a.val+=t;
	return min(a,calc(mid+1,R,k<<1|1));
}
void up(int L,int R,int k) {
	T[k].cost=T[k<<1].cost;
//	T[k].cost=min(T[k<<1].cost,T[k<<1|1].cost);
	T[k].ind1=min(T[k<<1].ind1,T[k<<1|1].ind1);
	T[k].mx=max(T[k<<1].mx,T[k<<1|1].mx);
	t=T[k<<1].mx;
	int mid=(L+R)>>1;
	T[k].ind2=calc(mid+1,R,k<<1|1);
}
void T_build(int L,int R,int k) {
	if (L==R) {
		T[k].ind1.pos=L;
		T[k].ind1.val=-suf[L];
		T[k].mx=suf[L];
		return;
	}
	int mid=(L+R)>>1;
	T_build(L,mid,k<<1);
	T_build(mid+1,R,k<<1|1);
	up(L,R,k);
}
void T_add(int L,int R,int l,int r,ll ad,int k) {
	if (L==l && R==r) {
		T[k].ind2.val+=ad;
		T[k].ad+=ad;
		T[k].cost+=ad;
		T[k].mx+=ad;
		return;
	}
	int mid=(L+R)>>1;
	down(k);
	if (r<=mid) T_add(L,mid,l,r,ad,k<<1);
	else {
		if (l>mid) T_add(mid+1,R,l,r,ad,k<<1|1);
		else T_add(L,mid,l,mid,ad,k<<1),T_add(mid+1,R,mid+1,r,ad,k<<1|1);
	}
	up(L,R,k);
}
int T_find(int L,int R,int k) {
	if (L==R) return L;
	int mid=(L+R)>>1;
	down(k);
	if (T[k<<1|1].cost<=K) return T_find(mid+1,R,k<<1|1);
	return T_find(L,mid,k<<1);
}
void T_query(int L,int R,int l,int r,int k) {
	if (L==l && R==r) {
		A[++nn].k=k;
		A[nn].L=L;
		A[nn].R=R;
		return;
	}
	int mid=(L+R)>>1;
	down(k);
	if (r<=mid) T_query(L,mid,l,r,k<<1);
	else {
		if (l>mid) T_query(mid+1,R,l,r,k<<1|1);
		else T_query(L,mid,l,mid,k<<1),T_query(mid+1,R,mid+1,r,k<<1|1);
	}
}
int T_right(int L,int R,int k) {
	if (L==R) return L;
	down(k);
	ll tt=t;
	int mid=(L+R)>>1;
	if (T[k<<1].mx>t) t=T[k<<1].mx;
	if (calc(mid+1,R,k<<1|1).val<=K) return T_right(mid+1,R,k<<1|1);
	t=tt;
	return T_right(L,mid,k<<1);
}
int get_ans() {
	int i;
	s[0]=-oo;
	for (i=1;i<=nn;i++)
		s[i]=max(s[i-1],T[A[i].k].mx);
	for (i=nn;i;i--) {
		t=s[i-1];
		if (calc(A[i].L,A[i].R,A[i].k).val<=K) return T_right(A[i].L,A[i].R,A[i].k);
	}
	return 0;
}
void dfs(int x) {
	if (nt[x]!=n+1) T_add(1,n,nt[x]-1,n,need[x],1);
	int tmp;
	if (T[1].cost>K) tmp=0;
	else tmp=T_find(1,n,1);
	if (tmp==n) tmp=n-1;
	nn=0;
	T_query(1,n,x,tmp+1,1);
	tmp=get_ans();
	if (tmp-x+1>ans) ans=tmp-x+1;
	for (int k=h[x];k;k=E[k].n) dfs(E[k].s);
	if (nt[x]!=n+1) T_add(1,n,nt[x]-1,n,-need[x],1);
}
int main() {
	R(n);R(K);ans=1;
	for (i=1;i<n;i++) R(w[i]);
	for (i=1;i<=n;i++) R(g[i]);
	for (i=1;i<n;i++) pre[i]=pre[i-1]+g[i]-w[i];
	for (i=2;i<=n;i++) suf[i]=suf[i-1]+g[i]-w[i-1];
	nt[n]=n+1;
	for (i=n-1;i;i--) {
		if (pre[i]-pre[i-1]<0) nt[i]=i+1;
		else {
			k=nt[i+1];
			while (k<=n && pre[k-1]-pre[i-1]>=0) k=nt[k];
			nt[i]=k;
		}
		if (nt[i]!=n+1) {
			need[i]=pre[i-1]-pre[nt[i]-1];
			E_add(i,nt[i]);
		}
	}
	T_build(1,n,1);
	for (i=1;i<=n;i++) if (nt[i]==n+1) dfs(i);
	printf("%d\n",ans);
}


#include <stdio.h>
//#define PRINTF if(debug)printf
long long seg[400000][7];
long long inf=(1LL<<62)-1LL;
int edgeN,qN,n,ans,layer;
long long k;
int q[200000],head[200000],edge[200000][2],pt[200000];
long long a[200000],b[200000],gap[200000],tau[200000];
int debug;
void calc_ans(int,int,int,long long);
long long calc_rh(int,int,int,long long);
/*
void print_seg(){
    if(debug){
        for(int i=0;i<(1<<(layer+1))-1;i++){
            for(int j=0;j<=6;j++){
                PRINTF(" %2d",seg[i][j]);
            }
            PRINTF("\n");
        }
    }
    return;
}
*/
long long max(long long a,long long b){
    return a>=b?a:b;
}
void recoup(int l,int r,int p){
    if(l-r){
        seg[p*2+1][6]+=seg[p][6];
        seg[p*2+1][1]+=seg[p][6];
        seg[p*2+1][2]-=seg[p][6];
        seg[p*2+1][5]+=seg[p][6];
        seg[p*2+2][6]+=seg[p][6];
        seg[p*2+2][1]+=seg[p][6];
        seg[p*2+2][2]-=seg[p][6];
        seg[p*2+2][5]+=seg[p][6];
        seg[p*2+1][3]=seg[p][3];
		seg[p*2+2][3]=max(seg[p][3],seg[p*2+1][1]);
    }
    seg[p][6]=0;
    return;
}
long long get_ls(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
	    return seg[p][1];
	}else{
	    recoup(lb,rb,p);
	    int m=(lb+rb)/2;
        if(r<=m) return get_ls(l,r,p*2+1,lb,m);
        else if(l>m) return get_ls(l,r,p*2+2,m+1,rb);
        else{
            return max(get_ls(l,m,p*2+1,lb,m),get_ls(m+1,r,p*2+2,m+1,rb));
        }
	}
}
long long getans(int l,int r,int p,int lb,int rb,long long &ls){
    if(l==lb&&r==rb){
        calc_ans(l,r,p,ls);
        ls=max(ls,seg[p][1]);
        return seg[p][4];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return getans(l,r,p*2+1,lb,m,ls);
        else if(l>m) return getans(l,r,p*2+2,m+1,rb,ls);
        else{
            return max(getans(l,m,p*2+1,lb,m,ls),getans(m+1,r,p*2+2,m+1,rb,ls));
        }
    }
}
long long gettot(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
        return seg[p][5];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return gettot(l,r,p*2+1,lb,m);
        else if(l>m) return gettot(l,r,p*2+2,m+1,rb);
        else{
            return max(gettot(l,m,p*2+1,lb,m),gettot(m+1,r,p*2+2,m+1,rb));
        }
    }
}
void addseg(int l,int r,int p,int lb,int rb,long long v){
    if(l==lb&&r==rb){
        seg[p][6]+=v;
        seg[p][1]+=v;
        seg[p][2]-=v;
        seg[p][5]+=v;
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m){
            addseg(l,r,p*2+1,lb,m,v);
        }else if(l>m){
            addseg(l,r,p*2+2,m+1,rb,v);
        }else{
            addseg(l,m,p*2+1,lb,m,v);
            addseg(m+1,r,p*2+2,m+1,rb,v);
        }
        seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
        seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
        seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
        seg[p*2+1][3]=seg[p][3];
        seg[p*2+2][3]=max(seg[p][3],seg[p*2+1][1]);
        recoup(lb,rb,p);
        seg[p][2]=calc_rh(m+1,rb,p*2+2,seg[p*2+1][1]);
    }
    return;
}
void dfs(int x){
    int l,r,m,y,i;
    long long ls;
    /*
    if(debug){
        ("**** %d\n",x);
        print_seg();
    }
    */
    if(x==0){
    x=x+1;
    x=x-1;
//    debug=1;
	}
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,-gap[x]);
    /*
    if(debug){
        PRINTF("#### %d\n",x);
        print_seg();
    }
    */
    for(l=x,r=n-1;l<r;){
        m=(l+r+1)/2;
        if(gettot(x,m-1,0,0,(1<<layer)-1)>k) r=m-1;
        else l=m;
    }
    y=r;
    for(l=x;l<r;){
        m=(l+r+1)/2;
        ls=(x==m?-inf:get_ls(x,m-1,0,0,(1<<layer)-1));
        //PRINTF("~~~~%d %lld\n",x,tmp);
        //print_seg();
        if(getans(m,y,0,0,(1<<layer)-1,ls)+k<0) r=m-1;
        else l=m;
    }
    /*
	debug=1;
    if(l-x+1==7){
        PRINTF("%d\n",x);
	}
	debug=0;
	*/
    ans=max(ans,l-x+1);
    for(i=head[x];~i;i=edge[i][1]) dfs(edge[i][0]);
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,gap[x]);
    return;
}
void calc_ans(int l,int r,int p,long long ls){
    if(l==r){
        seg[p][4]=seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        /*
        if(debug&&0){
		    PRINTF("-----------\n");
		    PRINTF("#%d %d %d\n",l,r,p);
            print_seg();
        }
        */
        if(ls>=seg[p*2+1][1]){
            calc_ans(m+1,r,p*2+2,ls);
            seg[p][4]=max(seg[p*2+1][0]-ls,seg[p*2+2][4]);
        }else{
            calc_ans(l,m,p*2+1,ls);
            seg[p][4]=max(seg[p*2+1][4],seg[p*2+2][2]);
        }
        /*
        if(debug&&0){
		    PRINTF("+++++++++++\n");
		    PRINTF("#%d %d %d\n",l,r,p);
            print_seg();
        }
        */
    }
    return;
}
long long calc_rh(int l,int r,int p,long long ls){
    if(l==r){
        return seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            return max(seg[p*2+1][0]-ls,calc_rh(m+1,r,p*2+2,ls));
        }else{
            return max(seg[p][2],calc_rh(l,m,p*2+1,ls));
        }
    }
}
void merge_seg(int l,int r,int p){
    if(l==r){
        return;
    }
    int m=(l+r)/2;
    merge_seg(l,m,p*2+1);
    merge_seg(m+1,r,p*2+2);
    seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
    seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
    seg[p][3]=seg[p*2+1][3];
    seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
    seg[p][6]=0;
    seg[p][2]=calc_rh(m+1,r,p*2+2,seg[p*2+1][1]);
    return;
}
void create_seg(){
    //0 tau
    //1 fuel
    //2 righthalf
    //3 leftside
    //4 ans
    //5 tot
    //6 delay
    int i,j;
    for(i=0;i<n;i++){
        j=(1<<layer)-1+i;
        seg[j][0]=tau[i];
        seg[j][1]=tau[i];
        seg[j][5]=0;
        seg[j][6]=0;
    }
    seg[j][3]=-inf;
    seg[j][4]=seg[j][0]-seg[j][3];
    merge_seg(0,(1<<layer)-1,0);
    //print_seg();
    return;
}
void addedge(int u,int v){
    pt[v]=u;
    edge[edgeN][0]=v;
    edge[edgeN][1]=head[u];
    head[u]=edgeN++;
    return;
}
int main(){
	//freopen("in","r",stdin);
    //freopen("out","w",stdout);
    debug=0;
    int i;
    scanf("%d%lld",&n,&k);
    for(layer=0;(1<<layer)<n;layer++);
    for(i=0;i<n-1;i++) scanf("%lld",b+i);
    for(i=0;i<n;i++) scanf("%lld",a+i);
    tau[0]=a[0];
    for(i=1;i<n;i++) tau[i]=tau[i-1]+a[i]-b[i-1];
    qN=0,edgeN=0;
    for(i=0;i<n;i++) head[i]=-1,pt[i]=-1;
    for(i=0;i<n-1;i++){
        q[qN++]=i;
        gap[q[qN-1]]=a[i]-b[i];
        while(qN&&gap[q[qN-1]]<0){
            addedge(i+1,q[--qN]);
            if(qN) gap[q[qN-1]]+=gap[q[qN]];
        }
    }
    create_seg();
    ans=1;
    for(i=n-1;i>=0;i--){
        if(pt[i]==-1) dfs(i);
    }
    /*
    if(debug){
        for(i=0;i<n;i++){
            for(int j=head[i];~j;j=edge[j][1]){
                PRINTF("%d %d %lld\n",edge[j][0],pt[edge[j][0]],gap[edge[j][0]]);
            }
        }
    }
    */
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#define LL __int64
LL seg[400000][7];
LL inf=(1LL<<62)-1LL;
int edgeN,qN,n,ans,layer,best;
LL k;
int q[200000],head[200000],edge[200000][2],pt[200000];
LL a[200000],b[200000],gap[200000],tau[200000];
void calc_ans(int,int,int,LL);
LL calc_rh(int,int,int,LL);
LL max(LL a,LL b){
    return a>=b?a:b;
}
void recoup(int l,int r,int p){
    if(l-r){
        seg[p*2+1][6]+=seg[p][6];
        seg[p*2+1][1]+=seg[p][6];
        seg[p*2+1][2]-=seg[p][6];
        seg[p*2+1][5]+=seg[p][6];
        seg[p*2+2][6]+=seg[p][6];
        seg[p*2+2][1]+=seg[p][6];
        seg[p*2+2][2]-=seg[p][6];
        seg[p*2+2][5]+=seg[p][6];
    }
    seg[p][6]=0;
    return;
}
LL getans(int l,int r,int p,int lb,int rb,LL &ls){
    if(l==lb&&r==rb){
        calc_ans(l,r,p,ls);
        if(seg[p][4]+k>=0){
	        if(l-r){
		        int m=(lb+rb)/2;
    		    LL tmpls=max(ls,seg[p*2+1][1]);
	    	    getans(m+1,r,p*2+2,m+1,r,tmpls);
	    	    if(best<m){
	    	        tmpls=ls;
	    	        getans(l,m,p*2+1,l,m,tmpls);
	    	    }
			}else{
			    best=max(best,l);
			}
		}
        ls=max(ls,seg[p][1]);
        return seg[p][4];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return getans(l,r,p*2+1,lb,m,ls);
        else if(l>m) return getans(l,r,p*2+2,m+1,rb,ls);
        else{
            LL tmp=getans(l,m,p*2+1,lb,m,ls);
			tmp=max(tmp,getans(m+1,r,p*2+2,m+1,rb,ls));
			return tmp;
        }
    }
}
LL gettot(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
        return seg[p][5];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return gettot(l,r,p*2+1,lb,m);
        else if(l>m) return gettot(l,r,p*2+2,m+1,rb);
        else{
            return max(gettot(l,m,p*2+1,lb,m),gettot(m+1,r,p*2+2,m+1,rb));
        }
    }
}
void addseg(int l,int r,int p,int lb,int rb,LL v){
    if(l==lb&&r==rb){
        seg[p][6]+=v;
        seg[p][1]+=v;
        seg[p][2]-=v;
        seg[p][5]+=v;
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m){
            addseg(l,r,p*2+1,lb,m,v);
        }else if(l>m){
            addseg(l,r,p*2+2,m+1,rb,v);
        }else{
            addseg(l,m,p*2+1,lb,m,v);
            addseg(m+1,r,p*2+2,m+1,rb,v);
        }
        seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
        seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
        seg[p][2]=calc_rh(m+1,rb,p*2+2,seg[p*2+1][1]);
    }
    return;
}
void dfs(int x){
    int l,r,m,y,i;
    LL ls;
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,-gap[x]);
    for(l=x,r=n-1;l<r;){
        m=(l+r+1)/2;
        if(gettot(x,m-1,0,0,(1<<layer)-1)>k) r=m-1;
        else l=m;
    }
    ls=-inf,best=x;
    getans(x,l,0,0,(1<<layer)-1,ls);
    ans=max(ans,best-x+1);
    for(i=head[x];~i;i=edge[i][1]) dfs(edge[i][0]);
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,gap[x]);
    return;
}
void calc_ans(int l,int r,int p,LL ls){
    if(l==r){
    	seg[p][4]=seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            calc_ans(m+1,r,p*2+2,ls);
            seg[p][4]=max(seg[p*2+1][0]-ls,seg[p*2+2][4]);
        }else{
            calc_ans(l,m,p*2+1,ls);
            seg[p][4]=max(seg[p*2+1][4],seg[p*2+2][2]);
        }
    }
    return;
}
LL calc_rh(int l,int r,int p,LL ls){
    if(l==r){
        return seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            return max(seg[p*2+1][0]-ls,calc_rh(m+1,r,p*2+2,ls));
        }else{
            return max(seg[p][2],calc_rh(l,m,p*2+1,ls));
        }
    }
}
void merge_seg(int l,int r,int p){
    if(l==r){
        return;
    }
    int m=(l+r)/2;
    merge_seg(l,m,p*2+1);
    merge_seg(m+1,r,p*2+2);
    seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
    seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
    seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
    seg[p][6]=0;
    seg[p][2]=calc_rh(m+1,r,p*2+2,seg[p*2+1][1]);
    return;
}
void create_seg(){
    //0 tau
    //1 fuel
    //2 righthalf
    //3 leftside
    //4 ans
    //5 tot
    //6 delay
    int i,j;
    for(i=0;i<n;i++){
        j=(1<<layer)-1+i;
        seg[j][0]=tau[i];
        seg[j][1]=tau[i];
        seg[j][5]=0;
        seg[j][6]=0;
    }
    seg[j][4]=seg[j][0]+inf;
    merge_seg(0,(1<<layer)-1,0);
    return;
}
void addedge(int u,int v){
    pt[v]=u;
    edge[edgeN][0]=v;
    edge[edgeN][1]=head[u];
    head[u]=edgeN++;
    return;
}
int main(){
	int i;
    scanf("%d%I64d",&n,&k);
    for(layer=0;(1<<layer)<n;layer++);
    for(i=0;i<n-1;i++) scanf("%I64d",b+i);
    for(i=0;i<n;i++) scanf("%I64d",a+i);
    tau[0]=a[0];
    for(i=1;i<n;i++) tau[i]=tau[i-1]+a[i]-b[i-1];
    qN=0,edgeN=0;
    for(i=0;i<n;i++) head[i]=-1,pt[i]=-1;
    for(i=0;i<n-1;i++){
        q[qN++]=i;
        gap[q[qN-1]]=a[i]-b[i];
        while(qN&&gap[q[qN-1]]<0){
            addedge(i+1,q[--qN]);
            if(qN) gap[q[qN-1]]+=gap[q[qN]];
        }
    }
    create_seg();
    ans=1;
    for(i=n-1;i>=0;i--){
        if(pt[i]==-1) dfs(i);
    }
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#define LL long long
LL seg[400000][7];
LL inf=(1LL<<62)-1LL;
int edgeN,qN,n,ans,layer;
LL k;
int q[200000],head[200000],edge[200000][2],pt[200000];
LL a[200000],b[200000],gap[200000],tau[200000];
void calc_ans(int,int,int,LL);
LL calc_rh(int,int,int,LL);
LL max(LL a,LL b){
    return a>=b?a:b;
}
void recoup(int l,int r,int p){
    if(l-r){
        seg[p*2+1][6]+=seg[p][6];
        seg[p*2+1][1]+=seg[p][6];
        seg[p*2+1][2]-=seg[p][6];
        seg[p*2+1][5]+=seg[p][6];
        seg[p*2+2][6]+=seg[p][6];
        seg[p*2+2][1]+=seg[p][6];
        seg[p*2+2][2]-=seg[p][6];
        seg[p*2+2][5]+=seg[p][6];
    }
    seg[p][6]=0;
    return;
}
LL get_ls(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
	    return seg[p][1];
	}else{
	    recoup(lb,rb,p);
	    int m=(lb+rb)/2;
        if(r<=m) return get_ls(l,r,p*2+1,lb,m);
        else if(l>m) return get_ls(l,r,p*2+2,m+1,rb);
        else{
            return max(get_ls(l,m,p*2+1,lb,m),get_ls(m+1,r,p*2+2,m+1,rb));
        }
	}
}
LL getans(int l,int r,int p,int lb,int rb,LL &ls){
    if(l==lb&&r==rb){
        calc_ans(l,r,p,ls);
        ls=max(ls,seg[p][1]);
        return seg[p][4];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return getans(l,r,p*2+1,lb,m,ls);
        else if(l>m) return getans(l,r,p*2+2,m+1,rb,ls);
        else{
            return max(getans(l,m,p*2+1,lb,m,ls),getans(m+1,r,p*2+2,m+1,rb,ls));
        }
    }
}
LL gettot(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
        return seg[p][5];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return gettot(l,r,p*2+1,lb,m);
        else if(l>m) return gettot(l,r,p*2+2,m+1,rb);
        else{
            return max(gettot(l,m,p*2+1,lb,m),gettot(m+1,r,p*2+2,m+1,rb));
        }
    }
}
void addseg(int l,int r,int p,int lb,int rb,LL v){
    if(l==lb&&r==rb){
        seg[p][6]+=v;
        seg[p][1]+=v;
        seg[p][2]-=v;
        seg[p][5]+=v;
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m){
            addseg(l,r,p*2+1,lb,m,v);
        }else if(l>m){
            addseg(l,r,p*2+2,m+1,rb,v);
        }else{
            addseg(l,m,p*2+1,lb,m,v);
            addseg(m+1,r,p*2+2,m+1,rb,v);
        }
        seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
        seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
        seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
        recoup(lb,rb,p);
        seg[p][2]=calc_rh(m+1,rb,p*2+2,seg[p*2+1][1]);
    }
    return;
}
void dfs(int x){
    int l,r,m,y,i;
    LL ls;
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,-gap[x]);
    for(l=x,r=n-1;l<r;){
        m=(l+r+1)/2;
        if(gettot(x,m-1,0,0,(1<<layer)-1)>k) r=m-1;
        else l=m;
    }
    y=r;
    for(l=x;l<r;){
        m=(l+r+1)/2;
        ls=(x==m?-inf:get_ls(x,m-1,0,0,(1<<layer)-1));
        if(getans(m,y,0,0,(1<<layer)-1,ls)+k<0) r=m-1;
        else l=m;
    }
    ans=max(ans,l-x+1);
    for(i=head[x];~i;i=edge[i][1]) dfs(edge[i][0]);
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,gap[x]);
    return;
}
void calc_ans(int l,int r,int p,LL ls){
    if(l==r){
        seg[p][4]=seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            calc_ans(m+1,r,p*2+2,ls);
            seg[p][4]=max(seg[p*2+1][0]-ls,seg[p*2+2][4]);
        }else{
            calc_ans(l,m,p*2+1,ls);
            seg[p][4]=max(seg[p*2+1][4],seg[p*2+2][2]);
        }
    }
    return;
}
LL calc_rh(int l,int r,int p,LL ls){
    if(l==r){
        return seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            return max(seg[p*2+1][0]-ls,calc_rh(m+1,r,p*2+2,ls));
        }else{
            return max(seg[p][2],calc_rh(l,m,p*2+1,ls));
        }
    }
}
void merge_seg(int l,int r,int p){
    if(l==r){
        return;
    }
    int m=(l+r)/2;
    merge_seg(l,m,p*2+1);
    merge_seg(m+1,r,p*2+2);
    seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
    seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
    seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
    seg[p][6]=0;
    seg[p][2]=calc_rh(m+1,r,p*2+2,seg[p*2+1][1]);
    return;
}
void create_seg(){
    //0 tau
    //1 fuel
    //2 righthalf
    //3 leftside
    //4 ans
    //5 tot
    //6 delay
    int i,j;
    for(i=0;i<n;i++){
        j=(1<<layer)-1+i;
        seg[j][0]=tau[i];
        seg[j][1]=tau[i];
        seg[j][5]=0;
        seg[j][6]=0;
    }
    seg[j][4]=seg[j][0]+inf;
    merge_seg(0,(1<<layer)-1,0);
    return;
}
void addedge(int u,int v){
    pt[v]=u;
    edge[edgeN][0]=v;
    edge[edgeN][1]=head[u];
    head[u]=edgeN++;
    return;
}
int main(){
    debug=0;
    int i;
    scanf("%d%lld",&n,&k);
    for(layer=0;(1<<layer)<n;layer++);
    for(i=0;i<n-1;i++) scanf("%lld",b+i);
    for(i=0;i<n;i++) scanf("%lld",a+i);
    tau[0]=a[0];
    for(i=1;i<n;i++) tau[i]=tau[i-1]+a[i]-b[i-1];
    qN=0,edgeN=0;
    for(i=0;i<n;i++) head[i]=-1,pt[i]=-1;
    for(i=0;i<n-1;i++){
        q[qN++]=i;
        gap[q[qN-1]]=a[i]-b[i];
        while(qN&&gap[q[qN-1]]<0){
            addedge(i+1,q[--qN]);
            if(qN) gap[q[qN-1]]+=gap[q[qN]];
        }
    }
    create_seg();
    ans=1;
    for(i=n-1;i>=0;i--){
        if(pt[i]==-1) dfs(i);
    }
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#define LL __int64
LL seg[400000][7];
LL inf=(1LL<<62)-1LL;
int edgeN,qN,n,ans,layer,best;
LL k;
int q[200000],head[200000],edge[200000][2],pt[200000];
LL a[200000],b[200000],gap[200000],tau[200000];
void calc_ans(int,int,int,LL);
LL calc_rh(int,int,int,LL);
LL max(LL a,LL b){
    return a>=b?a:b;
}
LL min(LL a,LL b){
    return a<=b?a:b;
}
void recoup(int l,int r,int p){
    if(l-r){
        seg[p*2+1][6]+=seg[p][6];
        seg[p*2+1][1]+=seg[p][6];
        seg[p*2+1][2]-=seg[p][6];
        seg[p*2+1][5]+=seg[p][6];
        seg[p*2+2][6]+=seg[p][6];
        seg[p*2+2][1]+=seg[p][6];
        seg[p*2+2][2]-=seg[p][6];
        seg[p*2+2][5]+=seg[p][6];
    }
    seg[p][6]=0;
    return;
}
LL getans(int l,int r,int p,int lb,int rb,LL &ls){
    if(l==lb&&r==rb){
        calc_ans(l,r,p,ls);
        if(seg[p][4]+k>=0){
	        if(l-r){
		        int m=(lb+rb)/2;
    		    LL tmpls=max(ls,seg[p*2+1][1]);
	    	    getans(m+1,r,p*2+2,m+1,r,tmpls);
	    	    if(best<m){
	    	        tmpls=ls;
	    	        getans(l,m,p*2+1,l,m,tmpls);
	    	    }
			}else{
			    best=max(best,l);
			}
		}
        ls=max(ls,seg[p][1]);
        return seg[p][4];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return getans(l,r,p*2+1,lb,m,ls);
        else if(l>m) return getans(l,r,p*2+2,m+1,rb,ls);
        else{
            LL tmp=getans(l,m,p*2+1,lb,m,ls);
			tmp=max(tmp,getans(m+1,r,p*2+2,m+1,rb,ls));
			return tmp;
        }
    }
}
int gettot(int l,int r,int p){
	if(l==r){
		return l;
	}else{
		recoup(l,r,p);
		int m=(l+r)/2;
		if(seg[p*2+2][5]>k) return gettot(l,m,p*2+1);
		else return gettot(m+1,r,p*2+2);
	}
}
void addseg(int l,int r,int p,int lb,int rb,LL v){
    if(l==lb&&r==rb){
        seg[p][6]+=v;
        seg[p][1]+=v;
        seg[p][2]-=v;
        seg[p][5]+=v;
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m){
            addseg(l,r,p*2+1,lb,m,v);
        }else if(l>m){
            addseg(l,r,p*2+2,m+1,rb,v);
        }else{
            addseg(l,m,p*2+1,lb,m,v);
            addseg(m+1,r,p*2+2,m+1,rb,v);
        }
        seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
        seg[p][5]=min(seg[p*2+1][5],seg[p*2+2][5]);
        seg[p][2]=calc_rh(m+1,rb,p*2+2,seg[p*2+1][1]);
    }
    return;
}
void dfs(int x){
    int bound,m,y,i;
    LL ls;
    if(~pt[x]) addseg(pt[x]-1,(1<<layer)-1,0,0,(1<<layer)-1,-gap[x]);
    bound=gettot(0,(1<<layer)-1,0)+1;
    bound=min(bound,n-1);
    bound=max(x,bound);
    ls=-inf,best=x;
    getans(x,bound,0,0,(1<<layer)-1,ls);
    ans=max(ans,best-x+1);
    for(i=head[x];~i;i=edge[i][1]) dfs(edge[i][0]);
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,gap[x]);
    return;
}
void calc_ans(int l,int r,int p,LL ls){
    if(l==r){
    	seg[p][4]=seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            calc_ans(m+1,r,p*2+2,ls);
            seg[p][4]=max(seg[p*2+1][0]-ls,seg[p*2+2][4]);
        }else{
            calc_ans(l,m,p*2+1,ls);
            seg[p][4]=max(seg[p*2+1][4],seg[p*2+2][2]);
        }
    }
    return;
}
LL calc_rh(int l,int r,int p,LL ls){
    if(l==r){
        return seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            return max(seg[p*2+1][0]-ls,calc_rh(m+1,r,p*2+2,ls));
        }else{
            return max(seg[p][2],calc_rh(l,m,p*2+1,ls));
        }
    }
}
void merge_seg(int l,int r,int p){
    if(l==r){
        return;
    }
    int m=(l+r)/2;
    merge_seg(l,m,p*2+1);
    merge_seg(m+1,r,p*2+2);
    seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
    seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
    seg[p][5]=min(seg[p*2+1][5],seg[p*2+2][5]);
    seg[p][6]=0;
    seg[p][2]=calc_rh(m+1,r,p*2+2,seg[p*2+1][1]);
    return;
}
void create_seg(){
    //0 tau
    //1 fuel
    //2 righthalf
    //3 leftside
    //4 ans
    //5 tot
    //6 delay
    int i,j;
    for(i=0;i<n;i++){
        j=(1<<layer)-1+i;
        seg[j][0]=tau[i];
        seg[j][1]=tau[i];
        seg[j][5]=0;
        seg[j][6]=0;
    }
    seg[j][4]=seg[j][0]+inf;
    merge_seg(0,(1<<layer)-1,0);
    return;
}
void addedge(int u,int v){
    pt[v]=u;
    edge[edgeN][0]=v;
    edge[edgeN][1]=head[u];
    head[u]=edgeN++;
    return;
}
int main(){
	int i;
    scanf("%d%I64d",&n,&k);
    for(layer=0;(1<<layer)<n;layer++);
    for(i=0;i<n-1;i++) scanf("%I64d",b+i);
    for(i=0;i<n;i++) scanf("%I64d",a+i);
    tau[0]=a[0];
    for(i=1;i<n;i++) tau[i]=tau[i-1]+a[i]-b[i-1];
    qN=0,edgeN=0;
    for(i=0;i<n;i++) head[i]=-1,pt[i]=-1;
    for(i=0;i<n-1;i++){
        q[qN++]=i;
        gap[q[qN-1]]=a[i]-b[i];
        while(qN&&gap[q[qN-1]]<0){
            addedge(i+1,q[--qN]);
            if(qN) gap[q[qN-1]]+=gap[q[qN]];
        }
    }
    create_seg();
    ans=1;
    for(i=n-1;i>=0;i--){
        if(pt[i]==-1) dfs(i);
    }
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#define LL __int64
LL seg[400000][7];
LL inf=(1LL<<62)-1LL;
int edgeN,qN,n,ans,layer,best;
LL k;
int q[200000],head[200000],edge[200000][2],pt[200000];
LL a[200000],b[200000],gap[200000],tau[200000];
void calc_ans(int,int,int,LL);
LL calc_rh(int,int,int,LL);
LL max(LL a,LL b){
    return a>=b?a:b;
}
void recoup(int l,int r,int p){
    if(l-r){
        seg[p*2+1][6]+=seg[p][6];
        seg[p*2+1][1]+=seg[p][6];
        seg[p*2+1][2]-=seg[p][6];
        seg[p*2+1][5]+=seg[p][6];
        seg[p*2+2][6]+=seg[p][6];
        seg[p*2+2][1]+=seg[p][6];
        seg[p*2+2][2]-=seg[p][6];
        seg[p*2+2][5]+=seg[p][6];
    }
    seg[p][6]=0;
    return;
}
LL getans(int l,int r,int p,int lb,int rb,LL &ls){
    if(l==lb&&r==rb){
        calc_ans(l,r,p,ls);
        if(seg[p][4]+k>=0){
	        if(l-r){
		        int m=(lb+rb)/2;
    		    LL tmpls=max(ls,seg[p*2+1][1]);
	    	    getans(m+1,r,p*2+2,m+1,r,tmpls);
	    	    if(best<m){
	    	        tmpls=ls;
	    	        getans(l,m,p*2+1,l,m,tmpls);
	    	    }
			}else{
			    best=max(best,l);
			}
		}
        ls=max(ls,seg[p][1]);
        return seg[p][4];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return getans(l,r,p*2+1,lb,m,ls);
        else if(l>m) return getans(l,r,p*2+2,m+1,rb,ls);
        else{
            return max(getans(l,m,p*2+1,lb,m,ls),getans(m+1,r,p*2+2,m+1,rb,ls));
        }
    }
}
LL gettot(int l,int r,int p,int lb,int rb){
	if(l==lb&&r==rb){
        return seg[p][5];
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m) return gettot(l,r,p*2+1,lb,m);
        else if(l>m) return gettot(l,r,p*2+2,m+1,rb);
        else{
            return max(gettot(l,m,p*2+1,lb,m),gettot(m+1,r,p*2+2,m+1,rb));
        }
    }
}
void addseg(int l,int r,int p,int lb,int rb,LL v){
    if(l==lb&&r==rb){
        seg[p][6]+=v;
        seg[p][1]+=v;
        seg[p][2]-=v;
        seg[p][5]+=v;
    }else{
        recoup(lb,rb,p);
        int m=(lb+rb)/2;
        if(r<=m){
            addseg(l,r,p*2+1,lb,m,v);
        }else if(l>m){
            addseg(l,r,p*2+2,m+1,rb,v);
        }else{
            addseg(l,m,p*2+1,lb,m,v);
            addseg(m+1,r,p*2+2,m+1,rb,v);
        }
        seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
        seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
        seg[p][2]=calc_rh(m+1,rb,p*2+2,seg[p*2+1][1]);
    }
    return;
}
void dfs(int x){
    int l,r,m,y,i;
    LL ls;
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,-gap[x]);
    for(l=x,r=n-1;l<r;){
        m=(l+r+1)/2;
        if(gettot(x,m-1,0,0,(1<<layer)-1)>k) r=m-1;
        else l=m;
    }
    ls=-inf,best=x;
    getans(x,l,0,0,(1<<layer)-1,ls);
    ans=max(ans,best-x+1);
    for(i=head[x];~i;i=edge[i][1]) dfs(edge[i][0]);
    if(~pt[x]) addseg(pt[x]-1,n-1,0,0,(1<<layer)-1,gap[x]);
    return;
}
void calc_ans(int l,int r,int p,LL ls){
    if(l==r){
    	seg[p][4]=seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            calc_ans(m+1,r,p*2+2,ls);
            seg[p][4]=max(seg[p*2+1][0]-ls,seg[p*2+2][4]);
        }else{
            calc_ans(l,m,p*2+1,ls);
            seg[p][4]=max(seg[p*2+1][4],seg[p*2+2][2]);
        }
    }
    return;
}
LL calc_rh(int l,int r,int p,LL ls){
    if(l==r){
        return seg[p][0]-ls;
    }else{
        recoup(l,r,p);
        int m=(l+r)/2;
        if(ls>=seg[p*2+1][1]){
            return max(seg[p*2+1][0]-ls,calc_rh(m+1,r,p*2+2,ls));
        }else{
            return max(seg[p][2],calc_rh(l,m,p*2+1,ls));
        }
    }
}
void merge_seg(int l,int r,int p){
    if(l==r){
        return;
    }
    int m=(l+r)/2;
    merge_seg(l,m,p*2+1);
    merge_seg(m+1,r,p*2+2);
    seg[p][0]=max(seg[p*2+1][0],seg[p*2+2][0]);
    seg[p][1]=max(seg[p*2+1][1],seg[p*2+2][1]);
    seg[p][5]=max(seg[p*2+1][5],seg[p*2+2][5]);
    seg[p][6]=0;
    seg[p][2]=calc_rh(m+1,r,p*2+2,seg[p*2+1][1]);
    return;
}
void create_seg(){
    //0 tau
    //1 fuel
    //2 righthalf
    //3 leftside
    //4 ans
    //5 tot
    //6 delay
    int i,j;
    for(i=0;i<n;i++){
        j=(1<<layer)-1+i;
        seg[j][0]=tau[i];
        seg[j][1]=tau[i];
        seg[j][5]=0;
        seg[j][6]=0;
    }
    seg[j][4]=seg[j][0]+inf;
    merge_seg(0,(1<<layer)-1,0);
    return;
}
void addedge(int u,int v){
    pt[v]=u;
    edge[edgeN][0]=v;
    edge[edgeN][1]=head[u];
    head[u]=edgeN++;
    return;
}
int main(){
	int i;
    scanf("%d%I64d",&n,&k);
    for(layer=0;(1<<layer)<n;layer++);
    for(i=0;i<n-1;i++) scanf("%I64d",b+i);
    for(i=0;i<n;i++) scanf("%I64d",a+i);
    tau[0]=a[0];
    for(i=1;i<n;i++) tau[i]=tau[i-1]+a[i]-b[i-1];
    qN=0,edgeN=0;
    for(i=0;i<n;i++) head[i]=-1,pt[i]=-1;
    for(i=0;i<n-1;i++){
        q[qN++]=i;
        gap[q[qN-1]]=a[i]-b[i];
        while(qN&&gap[q[qN-1]]<0){
            addedge(i+1,q[--qN]);
            if(qN) gap[q[qN-1]]+=gap[q[qN]];
        }
    }
    create_seg();
    ans=1;
    for(i=n-1;i>=0;i--){
        if(pt[i]==-1) dfs(i);
    }
    printf("%d\n",ans);
    return 0;
}