import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto X = s[1].to!long; auto A = readln.split.map!(to!long).array; auto B = new long[](N+1); foreach (i; 0..N) B[i+1] = B[i] + A[i]; long sum(int l, int r) { if (r < l) return 0; return B[r+1] - B[l]; } int calc_left(int l, int r) { int hi = r + 1; int lo = l; while (hi - lo > 1) { int mid = (hi + lo) / 2; if (sum(l, mid) <= X) lo = mid; else hi = mid; } return lo; } int calc_right(int l, int r) { int hi = r; int lo = l - 1; while (hi - lo > 1) { int mid = (hi + lo) / 2; if (sum(mid, r) <= X) hi = mid; else lo = mid; } return hi; } auto ans = new bool[][](N, N); foreach (l; 0..N) { int minr = l; foreach (r; l+1..N) { int nr = calc_right(l, r) - 1; if (nr <= minr) { ans[l][r] = true; } else { minr = r; } } } foreach (r; 0..N) { int maxl = r; foreach_reverse (l; 0..r) { int nl = calc_left(l, r) + 1; if (nl >= maxl) { ans[l][r] = true; } else { maxl = l; } } } writeln(ans[0][N-1] ? "A" : "B") ; }