def memoize(f):
    table = dict()
    def wrapper(x, a):
        key = (x, a)
        if key in table:
            return table[key]
        else:
            v = f(x, a)
            table[key] = v
            return v
    return wrapper

@memoize
def solve(x, a):
    if len(a) == 0:
        return 0

    if len(a) == 1:
        if a[0] == x:
            return 1
        else:
            return 0

    if x < a[0]:
        return solve(x, a[1:])
    else:
        m = solve(x - a[0], a[1:]) + 1
        n = solve(x, a[1:])
        return max(m, n)

def main():
    n, x = [int(s) for s in input().split()]
    a = tuple(int(s) for s in input().split())

    print(solve(x, a))

main()
