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 = [int(s) for s in input().split()]

    print(solve(x, a))

main()
