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]; } alias SegTree = SegmentTree!(int, (a,b)=>a+b, 0); auto rst = new SegTree[](N); auto cst = new SegTree[](N); foreach (i; 0..N) rst[i] = new SegTree(N); foreach (i; 0..N) cst[i] = new SegTree(N); 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; } foreach (len; 2..N+1) foreach (l; 0..N-len+1) { int r = l + len - 1; auto nr = calc_left(l, r) + 1; auto nl = calc_right(l, r) - 1; auto x = rst[l].query(l + 1, nr) != nr - l; auto y = cst[r].query(nl, r - 1) != r - nl; auto z = x | y; rst[l].add(r, 1); cst[r].add(l, 1); } writeln(rst[0].query(N-1, N-1) == 1 ? "A" : "B"); } class SegmentTree(T, alias op, T e) { T[] table; int size; int offset; this(int n) { size = 1; while (size <= n) size <<= 1; size <<= 1; table = new T[](size); fill(table, e); offset = size / 2; } void assign(int pos, T val) { pos += offset; table[pos] = val; while (pos > 1) { pos /= 2; table[pos] = op(table[pos*2], table[pos*2+1]); } } void add(int pos, T val) { pos += offset; table[pos] += val; while (pos > 1) { pos /= 2; table[pos] = op(table[pos*2], table[pos*2+1]); } } T query(int l, int r) { return query(l, r, 1, 0, offset-1); } T query(int l, int r, int i, int a, int b) { if (b < l || r < a) { return e; } else if (l <= a && b <= r) { return table[i]; } else { return op(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b)); } } }