output_description: Print the maximum possible number of happy children.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N x
      a_1 a_2 ... a_N
attempt: # _*_ coding:utf-8 _*_
  #  Atcoder_Beginners_Contest-
  #  Atcoder_Grand_Contest-
  #  TODO https://atcoder.jp/contests/abc/tasks/abc_
  import time
  from contextlib import contextmanager
  
  
  # from time import sleep
  @contextmanager
  def timer(title):
      t0 = time.time()
      yield
      print("{} - done in {:.0f}s".format(title, time.time() - t0))
  
  
  def countJoyChild(haveCookie, joyMeterList):
      joyMeterList.sort()
      childsCount = len(joyMeterList)
      sendCookieRangeMax = range(0, childsCount, +1)
      sendCookieChilds = 0
      for i in sendCookieRangeMax:
          haveCookie = haveCookie - joyMeterList[i]
          if 0 <= haveCookie:
              sendCookieChilds = sendCookieChilds + 1
          else:
              break
      if 0 < haveCookie:  # => 最後の一人が多すぎる
          sendCookieChilds = sendCookieChilds - 1
  
      answer = sendCookieChilds
      return answer
  
  
  if __name__ == "__main__":
      _, X = map(int, input().strip().split(" "))
      A = list(map(int, input().strip().split(" ")))
      # 	with timer("countJoyChild"):
      solution = countJoyChild(X, A)
      print("{}".format(solution))
  
problem_description: Statement
  
  There are N children, numbered 1, 2, ..., N.
  
  Snuke has decided to distribute x sweets among them. He needs to give out all
  the x sweets, but some of the children may get zero sweets.
  
  For each i (1 \leq i \leq N), Child i will be _happy_ if he/she gets exactly
  a_i sweets. Snuke is trying to maximize the number of happy children by
  optimally distributing the sweets. Find the maximum possible number of happy
  children.
samples: [{"input": "3 70\n    20 30 10", "output": "2\n    \n\nOne optimal way to distribute sweets is (20, 30, 20).\n\n* * *"}, {"input": "3 10\n    20 30 10", "output": "1\n    \n\nThe optimal way to distribute sweets is (0, 0, 10).\n\n* * *"}, {"input": "4 1111\n    1 10 100 1000", "output": "4\n    \n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\n* * *"}, {"input": "2 10\n    20 20", "output": "0\n    \n\nNo children will be happy, no matter how the sweets are distributed."}]