// @author godmar import java.util.*; import java.util.function.*; import java.io.*; import static java.lang.Math.*; public class godmar { public static void main(String ...av) { var sc = new Fast.Scanner(); var T = sc.nextInt(); PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < T; i++) pw.println(doOne(sc)); pw.close(); } static double doOne(Fast.Scanner sc) { int n = sc.nextInt(); long p = sc.nextLong(); double D = 0; long [] ti = new long[n]; for (int i = 0; i < n; i++) { ti[i] = sc.nextLong(); D += ti[i]; } double λ = p/D; // compute Lagrange multiplier in O(1) double s = 0; for (int i = 0; i < n; i++) s += ti[i] * λ * λ; return s; } } class Fast { //-----------Scanner class for faster input---------- /* Provides similar API as java.util.Scanner but does not * use regular expression engine. */ public static class Scanner { BufferedReader br; StringTokenizer st; public Scanner(Reader in) { br = new BufferedReader(in); } public Scanner() { this(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } // Slightly different from java.util.Scanner.nextLine(), // which returns any remaining characters in current line, // if any. String readNextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int[] readIntArray(int n) { int[] a = new int[n]; for (int idx = 0; idx < n; idx++) { a[idx] = nextInt(); } return a; } long[] readLongArray(int n) { long[] a = new long[n]; for (int idx = 0; idx < n; idx++) { a[idx] = nextLong(); } return a; } } //-------------------------------------------------------- }