#include #define REP(i, n) for(int i = 0 ; i< (int)n; ++i) #define X first #define Y second using namespace std; typedef long long ll; typedef pair li; bool testcase(){ int n; if(!(cin >> n))return false; int ff; cin >> ff; vector f(n, ff); vector c(n); vector prevtime(n, 0); REP(i, n){ cin >> c[i]; } auto cmp = [](const li & a, const li & b){ return a.X == b.X ? a.Y < b.Y : a.X > b.X; }; priority_queue, decltype(cmp)> pq(cmp); double time = 0; double lastpond = 0; vector done(n, false); vector nxt(n); REP(i, n){ nxt[i] = i+1; pq.push(li(c[i]/f[i], i)); } nxt[n-1] = -1; while(!pq.empty()){ auto tp = pq.top(); pq.pop(); int i = tp.Y; if(done[i])continue; done[i] = true; time = tp.X; if(i == n-1) lastpond = time; if(nxt[i]==-1)continue; if(done[nxt[i]])nxt[i] = nxt[nxt[i]]; if(nxt[i]==-1)continue; c[nxt[i]]-=(time - prevtime[nxt[i]])*f[nxt[i]]; f[nxt[i]] += f[i]; prevtime[nxt[i]] = time; pq.push(li(time+c[nxt[i]]/f[nxt[i]], nxt[i])); } cout << setprecision(9) << lastpond << " " << time << endl; return true; } /* 1.5625 1.5625 0.666666667 3.33333333 */ int main(){ while(testcase()); return 0; }