import itertools
n,x=map(int,input().split())
a=list(map(int, input().split()))
if sum(a)<x:
    print(len(a)-1)
else:
    ans=0
    for i in range(1,n+1):
        for v in itertools.combinations(a,i):
            if sum(v)<=x:
                ans=len(v)
    print(ans)