#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define range(a) a.begin(), a.end() int main() { int N; cin >> N; ll X; cin >> X; vector A(N); rep(i, N) cin >> A[i]; vector S(N + 1); rep(i, N) S[i + 1] = S[i] + A[i]; vector R(N + 1); repr(i, N) R[i] = R[i + 1] + A[i]; vector> dp(N, vector(N)); vector> eplr(N, vector(N)); vector> eprl(N, vector(N)); for (int d = 1; d <= N - 1; d++) { for (int l = 0; l + d <= N - 1; l++) { int r = l + d; eplr[l][r] = dp[l][l] + eplr[l + 1][r]; eprl[r][l] = dp[r][r] + eprl[r - 1][l]; // dpl[l][l+1]...dpl[l][l+x] -> 0 // dpr[r][r]...dpr[r][r-y] -> 0 int x = upper_bound(range(S), X + S[l]) - S.begin() - 1; int y = S.rend() - upper_bound(S.rbegin(), S.rend(), X + S[r + 1]) + 1; if (eplr[l][x] != x - l + 1) { dp[l][r] = 1; } if (eprl[r][y] != r - y + 1) { dp[l][r] = 1; } } } cout << (dp[0][N - 1] ? "A" : "B") << endl; }