# AGC027A - Candy Distribution Again
# greedy algorithm
from itertools import accumulate as acc


def main():
    # maximize the number of proper distribution -> begin with small values
    N, X, *A = map(int, open(0).read().split())
    A.sort()
    ac = list(acc(A))
    if ac[-1] < x:  # the last one receives more than expected -> ans - 1
        ans = n - 1
    else:
        ans = sum(i <= x for i in ac)
    print(ans)


if __name__ == "__main__":
    main()