import copy

n, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))

res_count = 0

def rec_count(a_list, ix=0):
  global res_count
  if len(a_list) == 0 or len(a_list) <= res_count:
    return None
  sum_a = sum(a_list)
  if sum_a == x:
    return len(a_list)
  if x > sum_a:
    return len(a_list) - 1
  c_list = [0]
  for i in range(ix, len(a_list)):
    tmp_a_list = copy .deepcopy(a_list)
    del tmp_a_list[ix]
    tmp_count = rec_count(tmp_a_list, i)
    if tmp_count is not None:
      c_list.append(tmp_count)
      if tmp_count > res_count:
        res_count = tmp_count
  return max(c_list)

tmp_count = rec_count(a_list)
if tmp_count > res_count:
  res_count = tmp_count
print(res_count)