import sys


# n = int(sys.stdin.readline().strip())
#
# line = sys.stdin.readline().strip()
# values = list(map(int, line.split()))


def main():
    line = sys.stdin.readline().strip()
    values = list(map(int, line.split()))
    N, x = values[0], values[1]
    line = sys.stdin.readline().strip()
    values = list(map(int, line.split()))
    d = {}
    d = [[-1 for j in range(x+1)] for i in range(N+1)]

    def rec(i, j):
        res = 0
        if d[i][j] >= 0:
            return d[i][j]
        if i == N:
            if j == 0:
                return 0
            else:
                return -1
        elif j < values[i]:
            res = rec(i + 1, j)
        else:
            res = max(rec(i + 1, j), rec(i + 1, j - values[i]) + 1)
        d[i][j] = res
        return res

    res = rec(0, x)
    if res == -1:
        print(0)
    else:
        print(res)


if __name__ == '__main__':
    main()
