Water cranes
Consider a system with n taps that fill a container with water. Each tap, numbered from 1 to n, can be adjusted to deliver any volume of water from 0 to a[i]
ml per second, where this volume can be a real number. The water from the i-th tap has a temperature of t[i]
.
If you set the i-th tap to pour exactly x[i]
ml of water per second, the resulting water temperature is calculated as:
Your task is to adjust all the taps so that the resulting temperature is exactly T. Determine the maximum volume of water per second that can be obtained at this temperature T.
Input
The first line contains two integers n and T (1 ≤ n ≤ 2·10^5
, 1 ≤ T ≤ 10^6
) – the number of taps and the desired water temperature.
The second line contains n integers a[1]
, a[2]
, ..., a[n]
(1 ≤ a[i]
≤ 10^6
) – the maximum volume of water each tap can deliver per second.
The third line contains n numbers t[1]
, t[2]
, ..., t[n]
(1 ≤ t[i]
≤ 10^6
) – the temperature of the water from each tap.
Output
Output the maximum possible volume of water at temperature T that can be obtained per second. If it is impossible to achieve the specified temperature, output 0.
Your answer will be accepted if its absolute or relative error is less than 10^(-3)
.