n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
  count = n - 1
else:
  for i in range(n):
    left = x - line[i]
    if left > 0:
       count += 1
    elif left == 0:
      count += 1
      break
    else:
      count -= 1
      break
  if count < 0:
    count = 0
print(count)