# https://atcoder.jp/contests/agc027/tasks/agc027_a
n, x = map(int, input().split())
nums = [int(i) for i in input().split()]
nums.sort()
ans = 0
for i in range(n):
    for j in range(i, n):
        s = sum(nums[i:j + 1])
        if s == x:
            ans = max(ans, j - i + 1)
        elif s < x:

            ans = max(ans, j - i)

print(ans)
