#include <bits/stdc++.h>
using namespace std;
#define int long long
using db = long double;
class BIT {
public:
vector<int> val;
BIT() { }
BIT(int n) { val.resize(n + 1); }
void clear() {
fill(val.begin(), val.end(), -1);
}
int lowbit(int x) { return x & -x; }
void add(int u, int x) {
for(int i = u; i < (int)val.size(); i += lowbit(i)) val[i] = max(x, val[i]);
}
int query(int u) {
int ans = -1; for(int i = u; i; i -= lowbit(i)) ans = max(ans, val[i]); return ans;
}
};
// results start with 1
void discretize(vector<db>& a) {
vector<db> b(a);
sort(b.begin() + 1, b.end());
b.erase(unique(b.begin() + 1, b.end()), b.end());
for(int i = 1; i < (int)a.size(); i++)
a[i] = lower_bound(b.begin() + 1, b.end(), a[i]) - b.begin();
}
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> s(n + 1);
for (int i = 1; i <= n; i++) {
s[i] = s[i - 1] + a[i];
}
auto check = [&](db m) {
vector<db> v(n + 2);
for (int i = 1; i <= n; i++) {
v[i] = s[i] - i * m;
// cerr << v[i] << " \n"[i == n];
}
discretize(v);
BIT bit(n + 1);
bit.add(v[n + 1], 0);
vector<int> dp(n + 1);
for (int i = 1; i <= n; i++) {
dp[i] = bit.query(v[i] - 1) + 1;
// cerr << i << ": " << v[i] << " " << bit.query(v[i] - 1) << " " << dp[i] << "\n";
bit.add(v[i], dp[i]);
}
// for (int i = 1; i <= n; i++) {
// cerr << dp[i] << " \n"[i == n];
// }
return dp[n] >= k;
};
// check(1.7);
db lo = 0, hi = 1000;
while (hi - lo > 1e-9) {
db m = (lo + hi) / 2;
if (check(m)) {
lo = m;
} else {
hi = m;
}
}
cout << fixed << setprecision(10) << (lo + hi) / 2 << "\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}
/*
*/#include <bits/stdc++.h>
using namespace std;
#define int long long
using db = long double;
class BIT {
public:
vector<int> val;
BIT() { }
BIT(int n) { val.resize(n + 1); }
void clear() {
fill(val.begin(), val.end(), -1);
}
int lowbit(int x) { return x & -x; }
void add(int u, int x) {
for(int i = u; i < (int)val.size(); i += lowbit(i)) val[i] = max(x, val[i]);
}
int query(int u) {
int ans = -1; for(int i = u; i; i -= lowbit(i)) ans = max(ans, val[i]); return ans;
}
};
// results start with 1
void discretize(vector<db>& a) {
vector<db> b(a);
sort(b.begin() + 1, b.end());
b.erase(unique(b.begin() + 1, b.end()), b.end());
for(int i = 1; i < (int)a.size(); i++)
a[i] = lower_bound(b.begin() + 1, b.end(), a[i]) - b.begin();
}
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> s(n + 1);
for (int i = 1; i <= n; i++) {
s[i] = s[i - 1] + a[i];
}
auto check = [&](db m) {
vector<db> v(n + 2);
for (int i = 1; i <= n; i++) {
v[i] = s[i] - i * m;
// cerr << v[i] << " \n"[i == n];
}
discretize(v);
BIT bit(n + 1);
bit.add(v[n + 1], 0);
vector<int> dp(n + 1);
for (int i = 1; i <= n; i++) {
dp[i] = bit.query(v[i] - 1) + 1;
// cerr << i << ": " << v[i] << " " << bit.query(v[i] - 1) << " " << dp[i] << "\n";
bit.add(v[i], dp[i]);
}
// for (int i = 1; i <= n; i++) {
// cerr << dp[i] << " \n"[i == n];
// }
return dp[n] >= k;
};
// check(1.7);
db lo = 0, hi = 1000;
while (hi - lo > 1e-9) {
db m = (lo + hi) / 2;
if (check(m)) {
lo = m;
} else {
hi = m;
}
}
cout << fixed << setprecision(10) << (lo + hi) / 2 << "\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}
/*
*/