num_children, num_snacks = list(map(int, input().split(' ')))
children = list(map(int, input().split(' ')))
children.sort()
print(children)

count = 0
for i in range(num_children+1):
  if num_snacks >= sum(children[:i+1]):
    count += 1
  else:
    break
print(count)

