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); auto minr = new int[](N); auto maxl = new int[](N); foreach (i; 0..N) minr[i] = maxl[i] = i; foreach (l; 0..N) foreach (r; l+1..N) { int nr = calc_right(l, r) - 1; int nl = calc_left(l, r) + 1; if (nr <= minr[l] || nl >= maxl[r]) { ans[l][r] = true; } else { minr[l] = r; maxl[r] = l; } } writeln(ans[0][N-1] ? "A" : "B"); }