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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1LL<<60)

signed main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    
    double dp[501][502];
    rep(i,501)rep(j,502)dp[i][j] = -INF;
    dp[0][0] = 0;
    
    vector<int> rs(n+1,0);
    rep(i,n)rs[i+1] = a[i];
    for(int i=1;i<=n;i++){
        rs[i] += rs[i-1];
    }
    
    auto ave = [&](int l,int r){
        int sum = rs[r] - rs[l];
        return (double)sum/(r-l);
    };
    
    for(int i=1;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=1;k<=n;k++){
                if(i-k<0 or j-(k-1)<0)break;
                dp[i][j] = max(dp[i][j],dp[i-k][j-(k-1)]+ave(i-k,i));
            }
        }
    }
    
    double ans = -INF;
    for(int j=n-m;j<=n;j++){
        ans = max(ans,dp[n][j]);
    }
    printf("%.20lf\n",ans);
}