408007: GYM102961 U Factory Machines

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

U. Factory Machinestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

A factory has $$$n$$$ machines which can be used to make products. Your goal is to make a total of $$$t$$$ products.

For each machine, you know the number of seconds it needs to make a single product. The machines can work simultaneously, and you can freely decide their schedule.

What is the shortest time needed to make $$$t$$$ products?

Input

The first input line has two integers $$$n$$$ and $$$t$$$: the number of machines and products.

The next line has $$$n$$$ integers $$$k_1,k_2,\dots,k_n$$$: the time needed to make a product using each machine.

Constraints:

  • $$$1 \le n \le 2\cdot 10^5$$$
  • $$$1 \le t \le 10^9$$$
  • $$$1 \le k_i \le 10^9$$$
Output

Print one integer: the minimum time needed to make $$$t$$$ products.

ExampleInput
3 7
3 2 5
Output
8

加入题单

上一题 下一题 算法标签: