#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][MAX_N][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 + 1; i <= r; i++){ if(now + a[i] > x) break; res |= rec(i, r, !A); } now = 0; for(int i = r - 1; i >= l; i--){ if(now + a[i] > x) break; res |= rec(l, i, !A); } return dp[l][r][A] = res; }else{ bool res = false; for(int i = l + 1; i <= r; i++){ if(now + a[i] > x) break; res |= !rec(i, r, !A); } now = 0; for(int i = r - 1; i >= l; i--){ if(now + a[i] > x) break; res |= !rec(l, i, !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, true)){ cout << "A" << endl; }else{ cout << "B" << endl; } return 0; }