#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000000 int main(){ int N,X; cin>>N>>X; vector a(N); for(int i=0;i>a[i]; } vector left(N),right(N); int l = 0; int r = 0; int sum = 0; while(true){ while(r != N && sum + a[r] <= X){ sum += a[r]; r++; } left[l] = r-l; sum -= a[l]; l++; if(l==N)break; } l=N-1; r=N-1; sum=0; while(true){ while(l!=-1&&sum+a[l]<=X){ sum += a[l]; l--; } right[r] = r-l; sum -= a[r]; r--; if(r<0)break; } //vector> dp_l(N,vector(N+1)),dp_r(N,vector(N+1)); int dp_l[5000][5001],dp_r[5000][5001]; for(int i=0;i=N)break; dp_l[l][i]=dp_l[l][i-1]; dp_r[r][i]=dp_r[r][i-1]; cnt = min(left[l],i-1); x = dp_r[r][i-1]-dp_r[r][i-cnt-1]; if(x!=cnt){ dp_l[l][i]++; dp_r[r][i]++; continue; } cnt = min(right[r],i-1); x = dp_l[l][i-1]-dp_l[l][i-cnt-1]; if(x!=cnt){ dp_l[l][i]++; dp_r[r][i]++; continue; } } } if(dp_l[0][N]==dp_l[0][N-1]){ cout<<"B"<