let n, x = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let _ =
  Array.sort (-) a_s;
  let c, r = Array.fold_left (fun (c, r) a -> (if a > r then c else c + 1), r - a) (0, x) a_s in
  Printf.printf "%d\n" @@ if r > 0 then n - 1 else c