Problem: problem

AOR Ika got a water tank with a size of $ 1 $ in length and $ N $ in width. The aquarium is tall enough to hold water. The aquarium has $ N-1 $ partitions and is evenly spaced into $ N $ compartments. When water was poured here, the height of the water in each section became $ a_i $.

AOR Ika decided to remove some dividers and reduce the number of compartments to $ M $ or less. When you have removed the dividers, find the maximum sum of the water heights in each compartment.

The thickness of the partition can be ignored.



input

$ N \ M $
$ a_1 \ cdots a_N $

output

Output the maximum value of the total water height of each section in one line. Also, output a line break at the end. It is acceptable if the relative or absolute error is less than or equal to $ 10 ^ {-6} $.

Example

Input

5 3
9 1 2 3 9


Output

20.000000

Solution (in CPP):

Solution:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<vector<ld>> dp(n,vector<ld>(n,0));
	REP(i,n) {
		REP(j,n) {
			if(j==0) {
				ll sum=0;
				REP(k,i+1) {
					sum+=a[k];
				}
				dp[i][j]=sum;
				continue;
			}
			if(j>i) {
				dp[i][j]=-INF*INF;
				continue;
			}
			ll sum=0;
			for(ll k=i; k>0; k--) {
				sum+=a[k];
				if(j-(i-k)>=0) dp[i][j]=max(dp[i][j],dp[k-1][j-(i-k)]+sum/(ld)(i-k+1));
			}
			sum+=a[0];
			if(j==i) dp[i][j]=max(dp[i][j],sum/(ld)(i+1));
		}
	}
	ld ans=0;
	FOR(i,n-m,n) ans=max(ans,dp[n-1][i]);
	cout<<fixed<<setprecision(39)<<ans<<endl;
}