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
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

int main() {
    int N, M;
    cin >> N >> M;
    vector<double> a(N), sum(N + 1);
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    

    auto calc = [&](int l, int r) { // [l..r]
        double w = r - l + 1;
        double vol = sum[r + 1] - sum[l];
        return vol / w;
    };

    vector<vector<double>> dp(N + 1, vector<double>(N + 1, -inf<double>));
    dp[0][0] = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j <= M; ++j) {
            if(j + 1 <= M) {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i]);
            }
            if(j - 1 >= 0) {
                for(int k = 0; k < i; ++k) {
                    dp[i + 1][j] = max(dp[i + 1][j], dp[k][j - 1] + calc(k, i));
                }
            }
        }
    }

    cout << fixed << setprecision(10) << *max_element(begin(dp[N]), end(dp[N])) << endl;
}
