(defvar *N* (read))
(defvar *x* (read))
(defvar *count* 0)

(defun run (lst)
  (let ((n (car lst)))
    (if (not (null n))
        (progn
          (setq *x* (- *x* (car lst)))
          (incf *count*)
          (cond ((and (= *count* 1) (> 0 *x*))
                 (setq *count* 0)
                 (return-from run nil))
                ((>= 0 *x*)
                 (return-from run nil)))
          (run (cdr lst)))
        (when (> *x* 0)
          (decf *count*)))))

(defun main ()
  (let ((lst (list nil)))
    (dotimes (n *N*)
      (push (read) lst))
    (setq lst (sort (cdr (reverse lst)) #'<))
    (run lst)
    (princ *count*)))

(main)