#!/usr/bin/env python3
import sys


def solve(N: int, x: int, a: "List[int]"):
    a = sorted(a, reverse=True)

    allocate = [0] * N
    # 配りきる
    while x >= 0 and x >= min(a):
        # 余ったらもっかい
        for i, ai in enumerate(a):
            if ai > x:
                continue
            x -= ai
            allocate[i] += ai

    # 配った値を見る
    ans = 0
    for ai, bi in zip(a, allocate):
        if ai == bi:
            ans += 1

    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, x, a)


if __name__ == "__main__":
    main()
