#include using namespace std; #define REP(i,a) for(int i = 0; i < (a); i++) #define ALL(a) (a).begin(),(a).end() typedef long long ll; typedef pair P; const int INF = 1e9; const long long LINF = 1e18; const long long MOD = 1e9 + 7; #define MAX_N 5000 int n; ll x; ll a[MAX_N]; int dp[MAX_N + 1][MAX_N + 1][2]; bool rec(int l, int r, bool A){ if(dp[l][r][A] != -1) return dp[l][r][A]; if(l > r) return A; ll now = 0; if(A){ bool res = false; for(int i = l; i <= r; i++){ if(now + a[i] > x) break; res |= rec(i + 1, r, !A); } now = 0; for(int i = r; i >= l; i--){ if(now + a[i] > x) break; res |= rec(l, i - 1, !A); } return dp[l][r][A] = res; }else{ bool res = false; for(int i = l; i <= r; i++){ if(now + a[i] > x) break; res |= !rec(i + 1, r, !A); } now = 0; for(int i = r; i >= l; i--){ if(now + a[i] > x) break; res |= !rec(l, i - 1, !A); } return dp[l][r][A] = !res; } } signed main(){ cin >> n >> x; REP(i,n){ cin >> a[i]; } memset(dp, -1, sizeof(dp)); if(rec(0, n - 1, true)){ cout << "A" << endl; }else{ cout << "B" << endl; } return 0; }