1021: Time to rotate
[Creator : ]
Description
Given N wheels, the ith wheel takes Xi seconds to rotate once. Each wheel rotates independently and rotate continually.
Given an integer T which is the total number of rotations of all the wheels, we would like to find out at what time t which the
total number of rotations of all the wheels are bigger than or equals to T.
Given an integer T which is the total number of rotations of all the wheels, we would like to find out at what time t which the
total number of rotations of all the wheels are bigger than or equals to T.
Input
The first line contains two integers will represent N and T.
The next line will contain N integers which are Xi
( 1 <= N <= 100,000 , 1 <= T <= 10,000,000 )
The next line will contain N integers which are Xi
( 1 <= N <= 100,000 , 1 <= T <= 10,000,000 )
Output
Output the minimum seconds required for the wheels to complete at least T rotations.
Sample Input Copy
3 5
1 2 3
Sample Output Copy
3
HINT
In the sample case, after 3 seconds, the first wheel rotates 3 rounds, the second one 1 round and the third one 1 round and
the total is 3+1+1 = 5 , and 3 seconds is the minimum number of seconds to reach 5 rotations in total
the total is 3+1+1 = 5 , and 3 seconds is the minimum number of seconds to reach 5 rotations in total