#include "bits/stdc++.h" using namespace std; using i64 = long long; signed main(){ int n, x; cin >> n >> x; vector v(n); int i, j, k, left, right; for(auto& w : v) cin >> w; vector r(n + 1, 0); for(i = 0; i < n; ++i) r[i + 1] = r[i] + v[i]; array nex, prev; for(i = 0; i < n; ++i){ auto it = upper_bound(r.begin(), r.end(), r[i] + x); int idx = distance(r.begin(), it); nex[i] = min(idx, n); auto it2 = lower_bound(r.begin(), r.end(), r[i + 1] - x); idx = distance(r.begin(), it2); prev[i] = max(0, idx - 1); } bitset<25000000> a; for(k = 1; k < n; ++k) for(i = 0, j = k; j < n; ++i, ++j){ bool f = false; for(right = max(i, prev[j]); right < j; ++right) if(!a[i * 5000 + right]){ f = true; break; } int left_bound = min(nex[i], j + 1); if(!f) for(left = i + 1; left < left_bound; ++left) if(!a[left * 5000 + j]){ f = true; break; } a.set(i * 5000 + j, f); } cout << (a[n - 1] ? "A" : "B") << endl; }