open System type [] kg let bitDP (xs: int64 list) n k = let mutable ans = 0L for i in 0 .. (1 <<< n) do let mutable sum = 0L for j in 0 .. (n-1) do if ((i >>> j) &&& 1) = 1 then sum <- sum + xs.[j] if sum <= k then ans <- max ans sum ans let N, K = let t = Console.ReadLine().Split() (t.[0] |> int), (t.[1] |> int64 |> (*) 1L) let A = List.init N (fun _ -> Console.ReadLine() |> int64 |> (*)1L) bitDP A N K |> Console.WriteLine