(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let rec solver lst x =
        match lst with
                  [] -> 0
                | first :: [] -> 
                        if (x - first) = 0 then
                                1
                        else
                                0
                | first :: rest -> 
                        if (x - first) = 0 then
                                1
                        else
                        if (x - first) < 0 then
                                0
                        else
                                let tmax = solver rest (x - first) in
                                let fmax = solver rest x in
                                        if (tmax + 1) < fmax then
                                                fmax
                                        else
                                                tmax + 1

let n, x = Scanf.sscanf (read_line ()) "%d %d" ( fun n x -> n, x)
let lst = Str.split (Str.regexp " ") (read_line ())
          |> List.map int_of_string 
          |> List.sort compare

let () =
        solver lst x
        |> Printf.printf "%d\n"
