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;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  vint a(n);
  vint sum(n+1, 0);
  rep(i, n) {
    cin >> a[i];
    sum[i+1] = sum[i]+a[i];
  }
  vector<vector<double> > dp(n+1, vector<double>(m+1, -1e9));
  dp[0][0] = 0;
  rep(i, n) {
    rep(j, m) {
      rep(k, i+1) {
	if(dp[k][j] == -1e9) continue;
	chmax(dp[i+1][j+1], dp[k][j]+(double)(sum[i+1]-sum[k])/(i+1-k));
      }
    }
  }
  /*
  rep(i, n+1) {
    rep(j, m+1) cout << dp[i][j] << " ";
    cout << endl;
  }
  */
  double ans = 0;
  rep(i, m+1) chmax(ans, dp[n][i]);
  cout << ans << endl;

  return 0;
}