#include<bits/stdc++.h>usingnamespace std;int n, d, x;longdouble w[15], tot, dp[(1<<15)][16], y;intmain(){
cin >> n >> d;for(int i =0; i < n; i ++) cin >> w[i], tot += w[i];
tot /=(longdouble)d;for(int i =0; i <(1<< n); i ++, y =0){for(int j =0; j < n; j ++) y +=((bool)(i &(1<< j)))* w[j];
dp[i][1]=pow(y-tot,2);for(int j=2;j<=d;j++){
dp[i][j]=dp[i][j-1]+dp[0][1];
x=i;while(x>0){
dp[i][j]=min(dp[i][j],dp[i-x][j-1]+dp[x][1]);
x=(x-1)&i;}}}printf("%.15Lf",(dp[(1<<n)-1][d]/((longdouble)d)));}