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 <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
double dp[555][555];
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,M;
  cin>>N>>M;
  ll a[N];
  FOR(i,0,N)cin>>a[i];
  ll sum[N+1];
  sum[0]=0;
  FOR(i,0,N)sum[i+1]=sum[i]+a[i];
  FOR(i,0,555)FOR(j,0,555)dp[i][j]=-1;
  dp[0][0]=0;
  FOR(i,0,N){
    FOR(j,0,i+1){
      if(dp[i][j]==-1)continue;
      // i+1~kを1つの区画にする場合
      FOR(k,i+1,N+1){
        dp[k][j+1]=max(dp[k][j+1],dp[i][j]+1.0*(sum[k]-sum[i])/(k-i));
      }
    }
  }
  double ans=-1.0;
  FOR(i,1,M+1)ans=max(ans,dp[N][i]);
  cout<<setprecision(10)<<ans<<endl;
  return 0;
}