import numpy as np import itertools n, x = tuple(map(int, input().split())) a = list(map(int, input().split())) left = np.zeros(n, dtype=np.int32) right = np.zeros(n, dtype=np.int32) l = 0 r = 0 s = 0 while True: while r != n and s + a[r] <= x: s += a[r] r += 1 left[l] = r - l s -= a[l] l += 1 if l == n: break l = n - 1 r = n - 1 s = 0 while True: while l != -1 and s + a[l] <= x: s += a[l] l -= 1 right[r] = r - l s -= a[r] r -= 1 if r < 0: break dp_l = np.zeros((n, n + 1), dtype=np.int32) dp_r = np.zeros((n, n + 1), dtype=np.int32) i = 0 j = 0 while i <= n: while j < n: if i == 0: dp_l[j][i] = 0 dp_r[j][i] = 0 j += 1 continue l = j r = j + i - 1 if r >= n: break cnt = min(left[l], i - 1) x = dp_r[r][i - 1] - dp_r[r][i - cnt - 1] if x != cnt: dp_l[l][i] = dp_l[l][i - 1] + 1 dp_r[r][i] = dp_r[r][i - 1] + 1 j += 1 continue cnt = min(right[r], i - 1) x = dp_l[l][i - 1] - dp_l[l][i - cnt - 1] if x != cnt: dp_l[l][i] = dp_l[l][i - 1] + 1 dp_r[r][i] = dp_r[r][i - 1] + 1 j += 1 continue dp_l[l][i] = dp_l[l][i - 1] dp_r[r][i] = dp_r[r][i - 1] j += 1 i += 1 j = 0 if dp_l[0][n] == dp_l[0][n - 1]: print("B") else: print("A")