import numpy as np
list = input().split(" ")
x = int(list[1])
a = input().split(" ")
a_num = np.array([int(n) for n in a])

a = np.sort(a_num)

for i in range(len(a)):
  if x < a[i]:
    print(str(i))
  x -= a[i]