Problem: Consider a system of n water taps all pouring water into the same container. The i-th water tap can be set to deliver any amount of water from 0 to ai ml per second (this amount may be a real number). The water delivered by i-th tap has temperature ti.

If for every <image> you set i-th tap to deliver exactly xi ml of water per second, then the resulting temperature of water will be <image> (if <image>, then to avoid division by zero we state that the resulting water temperature is 0).

You have to set all the water taps in such a way that the resulting temperature is exactly T. What is the maximum amount of water you may get per second if its temperature has to be T?

Input

The first line contains two integers n and T (1 ≤ n ≤ 200000, 1 ≤ T ≤ 106) — the number of water taps and the desired temperature of water, respectively.

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) where ai is the maximum amount of water i-th tap can deliver per second.

The third line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 106) — the temperature of water each tap delivers.

Output

Print the maximum possible amount of water with temperature exactly T you can get per second (if it is impossible to obtain water with such temperature, then the answer is considered to be 0).

Your answer is considered correct if its absolute or relative error doesn't exceed 10 - 6.

Examples

Input

2 100
3 10
50 150


Output

6.000000000000000


Input

3 9
5 5 30
6 6 10


Output

40.000000000000000


Input

2 12
1 3
10 15


Output

1.666666666666667

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		FasterScanner sc = new FasterScanner();

		int N = sc.nextInt();
		int Q = sc.nextInt();
		int[] A = sc.nextIntArray(N);
		int[] T = sc.nextIntArray(N);
		
		long match = 0;
		ArrayList<Tap> below = new ArrayList<>();
		ArrayList<Tap> above = new ArrayList<>();
		long belowA = 0;
		long belowAT = 0;
		long aboveA = 0;
		long aboveAT = 0;
		for (int i = 0; i < N; ++i) {
		  if (T[i] < Q) {
		    below.add(new Tap(A[i], Q - T[i]));
		    belowA += A[i];
		    belowAT += (long)A[i] * (Q - T[i]);
		  } else if (T[i] > Q) {
		    // System.out.printf("above here: %d - %d = %d\n", T[i], Q, T[i] - Q);
		    above.add(new Tap(A[i], T[i] - Q));
		    aboveA += A[i];
		    aboveAT += (long)A[i] * (T[i] - Q);
		  } else {
		    match += A[i];
		  }
		}
		
		// for (Tap t : below) {
		//   System.out.printf("below amt = %d, tdiff = %d\n", t.amt, t.tdiff);
		// }
		// for (Tap t : above) {
		//   System.out.printf("above amt = %d, tdiff = %d\n", t.amt, t.tdiff);
		// }
		
		if (below.size() == 0 && above.size() == 0) {
		  System.out.println(match);
		  return;
		}
		
		ArrayList<Tap> iter;
		long wantA, wantAT;
		if (belowAT < aboveAT) {
		  iter = above;
		  wantA = belowA;
		  wantAT = belowAT;
		} else {
		  iter = below;
		  wantA = aboveA;
		  wantAT = aboveAT;
		}
		
		long iterA = 0;
		long iterAT = 0;
		double extraA = 0;
		
		Collections.sort(iter, Tap.BY_TDIFF);
		for (int i = 0; i < iter.size(); ++i) {
		  Tap t = iter.get(i);
		  long nextA = iterA + t.amt;
		  long nextAT = iterAT + t.amt * t.tdiff;
		  if (wantAT < nextAT) {
		    // System.out.printf("HERE: %d\n", t.tdiff);
		    // extraA = (wantAT * iterA - wantA * iterAT) / (wantA * t.tdiff - wantAT);
		    extraA = (double)(wantAT - iterAT) / t.tdiff;
		    break;
		  }
		  iterA = nextA;
		  iterAT = nextAT;
		}
		// System.out.printf("match = %d, wantA = %d, wantAT = %d, iterA = %d, iterAT = %d, extraA = %f\n", match, wantA, wantAT, iterA, iterAT, extraA);
		System.out.printf("%.16f\n", match + wantA + iterA + extraA);
	}
	
	public static class Tap {
	  public long amt, tdiff;
	  
	  public Tap(long a, long t) {
	    this.amt = a;
	    this.tdiff = t;
	  }
	  
	  public static final Comparator<Tap> BY_TDIFF = new Comparator<Tap>() {
	    @Override
	    public int compare(Tap lhs, Tap rhs) {
	      return Long.compare(lhs.tdiff, rhs.tdiff);
	    }
	  };
	}
	
// 	public static long[] getAmountSums(ArrayList<Tap> taps) {
// 	  final int K = taps.size();
// 	  long[] amounts = new long[K];
// 	  for (int i = 0; i <= K; ++i) {
// 	    amounts[i + 1] = amounts[i] + taps.get(i).amt;
// 	  }
// 	  return amounts;
// 	}
	
// 	public static long[] getMixtureSums(ArrayList<Tap> taps) {
// 	  final int K = taps.size();
// 	  long[] mixture = new long[K];
// 	  for (int i = 0; i <= K; ++i) {
// 	    Tap t = taps.get(i);
// 	    mixture[i + 1] = mixture[i] + (t.amt * t.tdiff);
// 	  }
// 	  return mixture;
// 	}
	
// 	public static double getMixtureTemp(double used, long[] amts, long[] mix, Tap[] taps) {
// 	  int L = 0;
// 	  int R = amts.length - 1;
// 	  int good = 0;
// 	  while (L <= R) {
// 	    int M = (L + R) >> 1;
// 	    if (amts[M] < used) {
// 	      L = M + 1;
// 	      good = L;
// 	    } else {
// 	      R = M - 1;
// 	    }
// 	  }
// 	  double rem = used - amts[good];
// 	  return (mix[good] + (rem * taps[good].tdiff)) / used;
// 	}
	
// 	public static double findMixtureTemp(double want, long[] amts, long[] mix, Tap[] taps) {
// 	  double L = 0;
// 	  double 
// 	}

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			return nextIntArray(n, 0);
		}

		public int[] nextIntArray(int n, int off) {
			int[] arr = new int[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			return nextLongArray(n, 0);
		}

		public long[] nextLongArray(int n, int off) {
			long[] arr = new long[n + off];
			for (int i = 0; i < n; i++) {
				arr[i + off] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}