let I() = stdin.ReadLine().Split(' ') |> Array.map int let N,M = let a = I() in a.[0],a.[1] I() |> Seq.sort |> Seq.scan (fun (c,s) n -> if M>=s+n then c+1,s+n else c,M+1) (0,0) |> Seq.takeWhile (snd>>((>=)M)) |> Seq.last |> fst |> printfn "%d"