#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x << " " << x << endl
typedef long double ldouble;
const int N = 1e5 + 10;
// adjustment 1
struct frac1 {
ldouble a, b;
bool operator < (const frac1 &f) const {
return (a/b) * (f.b + 1) < (f.a/f.b) * (b + 1);
}
};
// adjustment 2
struct frac2 {
ldouble a, b;
bool operator < (const frac2 &f) const {
return (a/b) * (f.b - 1) >= (f.a/f.b) * (b - 1);
}
};
int n;
long long k;
ldouble a[N], b1[N], b2[N], sum = 0.0;
priority_queue <frac1> pq1;
priority_queue <frac2> pq2;
int main (int argc, char const *argv[]) {
freopen("tallbarn.in", "r", stdin);
freopen("tallbarn.out", "w", stdout);
scanf("%d %lld", &n, &k);
for (int i = 1; i <= n; ++i) {
scanf("%Lf", a + i);
sum += sqrt(a[i]);
}
ldouble t = sum/k, bsum;
for (int i = 1; i <= n; ++i) {
b1[i] = b2[i] = sqrt(a[i])/t;
}
bsum = 0;
for (int i = 1; i <= n; ++i) {
if (b1[i] < 1.0) b1[i] = 1.0;
else b1[i] = floor(b1[i]);
bsum += b1[i];
frac1 frac;
frac.a = a[i], frac.b = b1[i];
pq1.push(frac);
}
long long down = floor(k - bsum + 0.5);
// debug(down);
while (down--) {
frac1 frac = pq1.top();
pq1.pop();
frac.b += 1.0;
pq1.push(frac);
}
bsum = 0;
for (int i = 1; i <= n; ++i) {
if (b2[i] < 1.0) b2[i] = 1.0;
else b2[i] = ceil(b2[i]);
bsum += b2[i];
frac2 frac;
frac.a = a[i], frac.b = b2[i];
pq2.push(frac);
}
// debug(bsum);
long long up = floor(bsum - k + 0.5);
// debug(up);
while (up--) {
frac2 frac = pq2.top();
pq2.pop();
frac.b -= 1.0;
pq2.push(frac);
}
ldouble res1 = 0.0, res2 = 0.0;
while (!pq1.empty()) {
frac1 frac = pq1.top();
pq1.pop();
res1 += frac.a/frac.b;
}
while (!pq2.empty()) {
frac2 frac = pq2.top();
pq2.pop();
res2 += frac.a/frac.b;
}
// debug(res1); debug(res2);
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