#include using namespace std; typedef long long ll; ll N,X; vector a; int dp[5010][5010][2]; bool rec(ll l, ll r, bool turn){ int c = 0; if(turn){ c = 1;} if( dp[l][r][c] != -1){ return dp[l][r][c];} if( r-l == 0){ //1つのみが残っている時 このターンに回ってきた方が負ける return !turn; } else{ ll left = l; ll right = r; ll res1 = 0,res2 = 0; if( turn ){ // Aのターンの時 while(left < r && res1+a[left] <= X){ left++; if( rec(left,r,!turn) == true ){ dp[l][r][1] = 1; return true;} //一つでもtrueが返せる瞬間があったら、Aは勝てる } while(right > l && res2+a[right] <= X){ right--; if( rec(l,right,!turn) == true ){ dp[l][r][1] = 1; return true;} } dp[l][r][1] = 0; return false; } else{ while(left < r && res1+a[left] <= X){ left++; if( rec(left,r,!turn) == false ){ dp[l][r][0] = 0;return false;} } while(right > l && res2+a[right] <= X){ right--; if( rec(l,right,!turn) == false){ dp[l][r][0] = 0; return false;} } dp[l][r][0] = 1; return true; } } } int main(){ cin >> N >> X; a.resize(N); for(ll i = 0; i < N; i++){ cin >> a[i];} for(int i = 0; i < 5010; i++){ for(int j = 0; j < 5010; j++){ dp[i][j][0] = -1; dp[i][j][1] = -1; } } bool res = rec(0,N-1,true); if( res ){ cout << "A" << endl;} else{ cout <<"B" << endl;} return 0; }