defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts(if b, do: "Yes", else: "No") @inf 10 ** 12 def main do [_, d] = li() input() vs = li() ans = bsearch(@inf, 0, @inf, d, vs) IO.puts ans end def f(t, vs) do for v <- vs, reduce: 0 do acc -> acc + v * t end end def bsearch(res, lo, hi, d, vs) do if lo > hi do res else m = div(lo + hi, 2) s = f(m, vs) if s >= d do bsearch(min(res, m), lo, m-1, d, vs) else bsearch(res, m+1, hi, d, vs) end end end end