(let* ((n (read))
       (m (read))
       (lst (sort (loop :repeat n :collect (read)) #'<))
       (ans 0))
  (setf ans (count t (mapcar (lambda (k) (setf m (- m k)) (<= 0 m)) lst)))
  (if (= m 0)
      (princ ans)
      (princ (1- ans))))