- Time limit: 1.00 s
- Memory limit: 512 MB
A factory has machines which can be used to make products. Your goal is to make a total of 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 products?
Input
The first input line has two integers and : the number of machines and products.
The next line has integers : the time needed to make a product using each machine.
Output
Print one integer: the minimum time needed to make products.
Constraints
Example
Input:
3 7 3 2 5
Output:
8
Explanation: Machine 1 makes two products, machine 2 makes four products and machine 3 makes one product.