# encoding: utf-8
# N = int(input())
# S = input()
# N, M = map(int, input().split())
# A = list(map(int, input().split()))

N, x = map(int, input().split())
A = list(map(int, input().split()))

tab = [[None] * (x + 1) for i in range(N)]

def recsearch(i, x_tmp):
    # print("#", i, x_tmp)
    if i == N:
        if x_tmp > 0: return -1
        else: return 0
    elif tab[i][x_tmp] != None: ret = tab[i][x_tmp] # read
    elif x_tmp == 0: ret = 0
    elif x_tmp < A[i]: ret = recsearch(i + 1, x_tmp)
    else: ret = max((recsearch(i + 1, x_tmp - A[i]) + 1, recsearch(i + 1, x_tmp)))
    if tab[i][x_tmp] == None: tab[i][x_tmp] = ret # write
    return ret

print(max(0, recsearch(0, x)))