#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; const int MA = 5003; int lr[MA][MA], rl[MA][MA], toLeft[MA], toRight[MA]; void solve() { int N, X; cin >> N >> X; vi A(N); rep(i, N) { cin >> A[i]; } rep(i, N) { ll sum = 0; FOR(j, i, N) { sum += A[j]; if (sum > X) { break; } // [i, j] toRight[i] = j + 1; } sum = 0; for (int j = i; j >= 0; --j) { sum += A[j]; if (sum > X) { break; } // [j, i] toLeft[i] = j; } } int res = 0; for (int len = 2; len <= N; ++len) { for (int i = 0; i + len <= N; ++i) { lr[i][i + len] += lr[i][i + len - 1]; rl[i + len][i] += rl[i + len][i + 1]; res = lr[i][i + len] + rl[i + len][i] > 0 ? 1 : 0; if (res == 0) { lr[i][i + len + 1]++; lr[i][toRight[i + len] + 1]--; if (i > 0) { rl[i + len][i - 1]++; if (toLeft[i] > 0) { rl[i + len][toLeft[i] - 1]--; } } } } } cout << (res ? 'A' : 'B') << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }