// // Created by yamunaku on 2020/01/17. // #include using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) #define repl(i, l, r) for(int i = (l); i < (r); i++) #define per(i, n) for(int i = ((n)-1); i >= 0; i--) #define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--) #define all(x) (x).begin(),(x).end() #define MOD9 998244353 #define MOD1 1000000007 #define IINF 1000000000 #define LINF 1000000000000000000 #define SP <<" "<< #define CYES cout<<"Yes"<; using mti = vector>; using vl = vector; using mtl = vector>; using pi = pair; using pl = pair; template using heap = priority_queue, function>; int main(){ // CFS; int n; cin >> n; ll x; cin >> x; vl a(n); rep(i, n) cin >> a[i]; vi li(n + 1, 0), lj(n + 1, 0); li[n] = n, lj[n] = n; ll r = 0; int idx = 0; rep(i, n){ while(idx < n){ if(r + a[idx] > x) break; r += a[idx]; idx++; } li[i] = idx; r -= a[i]; } r = 0; idx = 0; per(i, n){ while(idx < n){ if(r + a[n - 1 - idx] > x) break; r += a[n - 1 - idx]; idx++; } lj[n - 1 - i] = idx; r -= a[i]; } vector> dp(5001, bitset<5001>()); vi ci(n + 1, 0), cj(n + 1, 0); rep(i, n + 1){ rep(j, n + 1){ if(i + j >= n) dp[i][j] = true; } } per(i, n){ per(j, n){ if(i + j >= n) continue; repl(k, li[i] + 1, li[i + 1] + 1){ if(!dp[k][j]) ci[j]--; } repl(k, lj[j] + 1, lj[j + 1] + 1){ if(!dp[i][k]) cj[i]--; } if(ci[j] + cj[i] > 0) dp[i][j] = true; if(!dp[i][j]){ ci[j]++; cj[i]++; } } } // rep(i, n + 1){ // rep(j, n + 1){ // if(dp[i][j]) cout << "1"; // else cout << "0"; // } // cout << endl; // } if(dp[0][0]) cout << "A" << endl; else cout << "B" << endl; return 0; }