#include using namespace std; #pragma GCC optimize("Ofast") #define rep(i,n) for(ll i=0;i=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define pqueue(x) priority_queue,greater> #define all(x) (x).begin(),(x).end() #define CST(x) cout<> #define rev(x) reverse(x); using ll=long long; using vl=vector; using vvl=vector>; using pl=pair; using vpl=vector; using vvpl=vector; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[9]={0,1,0,-1,1,1,-1,-1,0}; const ll dx[9]={1,0,-1,0,1,-1,1,-1,0}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template struct BIT{ int n; T def; vector data; function fx; BIT(int _n,T _def,function _fx){ n=_n;def=_def;fx=_fx; data.resize(n,def); } void update(int a,T val){ for(int x=a;x=0;x=(x&(x+1))-1){ ret=fx(ret,data[x]); } return ret; } }; int main(){ ll n,x;cin >> n >> x; vl a(n);rep(i,n)cin >> a[i]; vl cum(n+1);rep(i,n)cum[i+1]=cum[i]+a[i]; vector> stl,str; BIT tmp(n,0,[](int16_t a,int16_t b){return a+b;}); rep(i,n){ stl.emplace_back(tmp); str.emplace_back(tmp); } rep(i,n)stl[i].update(i,1); rep(i,n)str[i].update(i,1); for(ll len=2;len<=n;len++){ for(ll l=0;l1){ ll mid=(ok+ng)>>1; if(cum[mid]-cum[l]<=x)ok=mid; else ng=mid; } nl=ok; } { ll ok=r,ng=l-1; while(ok-ng>1){ ll mid=(ok+ng)>>1; if(cum[r]-cum[mid]<=x)ok=mid; else ng=mid; } nr=ok; } //cout << l <<" " << r <<" " << nl <<" " << nr << endl; auto f=stl[l].fold(r)-stl[l].fold(nr-1)+str[r-1].fold(nl+1)-str[r-1].fold(l); //auto f=stl[l].query(nr-1,r)+str[r-1].query(l,nl+1); if(!f)stl[l].update(r-1,1); if(!f)str[r-1].update(l,1); } } /*rep(i,n){ rep(j,n)cout << stl[i][j] <<" ";cout << endl; }*/ if(stl[0].fold(n)-stl[0].fold(n-1)==1)cout << "B" << endl; else cout << "A" << endl; }