let ``No.5 数字のブロック`` () = let L = int <| stdin.ReadLine() let M = int <| stdin.ReadLine() let N = stdin.ReadLine().Split(' ') |> Seq.map int |> Seq.sort |> Seq.toList let rec f s c = function | [] -> c | x::xs -> if s >= L then c else f (s+x) (c+1) xs printfn "%d" ((f 0 0 N)-1) ``No.5 数字のブロック`` ()