from itertools import combinations

N, x = input().split()
a = input().split()

N = int(N)
x = int(x)
a = list(map(int, a))

if x < min(a):
    print(0)
elif x >= sum(a):
    print(N)
else:
    for i in range(N, 0, -1):
        c = list(combinations(a, i))

        for j in c:
            if x >= sum(j):
                print(i)
                exit(0)
        