open Batteries

let calc x li =
  let rec aux c sum = function
    | [] when sum = x -> c
    | [] -> c - 1
    | a :: al when a + sum > x -> c
    | a :: al -> aux (1 + c) (a + sum) al
  in
  aux 0 0 li

let () =
  Scanf.scanf " %d %d " (fun n x ->
      List.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
      |> List.sort (fun x y -> x - y)
      |> calc x |> Printf.printf "%d\n" )
