#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1000000007 //#define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 using ll = long long; using Pi = pair; using Pl = pair; bool dp[5020][5020]; int N,X; vector a; vector> used; vector sum; bool solve(int l,int r){ if(used[l][r]) return dp[l][r]; used[l][r] = true; if(r-l == 1) return dp[l][r] = false; bool res = false; repr(i,l,r){ if(sum[i+1] > X) break; if(!solve(i,r)) res = true; } for(int i = r-1; i >= l+1; i--){ if(sum[r]-sum[i] > X) break; if(!solve(l,i)) res = true; } return dp[l][r] = res; } int main(){ cin >> N >> X; a.resize(N); used.resize(N,vector(N,false)); sum.resize(N+1); rep(i,N) cin >> a[i]; rep(i,N) sum[i+1] = sum[i]+a[i]; cout << (solve(0,N)?'A':'B') << endl; }