#include using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; ll x; cin >> n >> x; vector a(n), sum(n + 1, 0); for (int i = 0; i < n; ++i) { cin >> a[i]; sum[i + 1] = sum[i] + a[i]; } vector nex_row(n + 1, 0), nex_col(n + 1, 0); for (int i = 0; i <= n; ++i) { nex_row[i] = i + 1; nex_col[i] = i - 1; } for (int d = 1; d < n; ++d) { vector tmp_row = nex_row, tmp_col = nex_col; for (int i = 0; i <= n - d; ++i) { if (nex_row[i] > i + d || nex_col[i + d] < i) continue; { int idx = lower_bound(sum.begin(), sum.begin() + i, sum[i] - x) - sum.begin(); tmp_col[i + d] = min(tmp_col[i + d], idx - 1); } { int idx = upper_bound(sum.begin() + i + d, sum.end(), x + sum[i + d]) - sum.begin(); tmp_row[i] = max(tmp_row[i], idx); } } nex_row = move(tmp_row); nex_col = move(tmp_col); } cout << ((nex_row[0] > n || nex_col[n] < 0) ? "A" : "B") << "\n"; return 0; }