import sys
import itertools

lines = sys.stdin.readlines()

for n, line in enumerate(lines):
  if not n:
    N, x = [int(_) for _ in line.strip().split(' ')]
    continue
  children = sorted([int(_) for _ in line.strip().split(' ')])
  break
  
child_max = max(children)
coef_pattern = [_ for _ in range(x // child_max + 1)]
child_id = [_ for _ in range(len(children))]
pattern = list(itertools.product(coef_pattern, child_id))
all_pattern = list(itertools.permutations(pattern))
#print(all_pattern)
max_cnt = 0
for ap in all_pattern:
  total = 0
  cnt = 0
  #print('ap:{}'.format(ap))
  log = []
  given_child = []
  for p in ap:
    #print('p[1]:{}, p[0]:{}'.format(p[1], p[0]))
    total += children[p[1]] * p[0]
    if not p[0] == 0 and not p[1] in given_child:
      cnt += 1
      #log.append('total:{}, p[1]:{}, p[0]:{}'.format(total, p[1], p[0]))
      given_child.append(p[1])
    #print('total:{}'.format(total))
    if total == x:
      if max_cnt < cnt:
        max_cnt = cnt
        #print(log)
print(max_cnt)