#include using namespace std; #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define rep(i, n) repl(i, 0, n) #define CST(x) cout << fixed << setprecision(x) using ll = long long; const ll MOD = 1000000007; const int inf = 1e9 + 10; const ll INF = 4e18 + 10; const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}; const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0}; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int n, v; cin >> n >> v; ll C[n]; double c[n]; priority_queue, vector>, greater>> que; rep(i, n) { cin >> C[i]; c[i] = C[i]; if (i) c[i] += c[i - 1]; double p = i + 1; que.push({c[i] / p, i + 1}); } if (n >= v) { cout << c[n - 1] << endl; return 0; } ll ans = c[n - 1]; v -= n; while (!que.empty()) { if (v <= 0) break; pair q = que.top(); que.pop(); if (q.second > v) continue; ans += v / q.second * c[q.second - 1]; v %= q.second; } cout << ans << endl; return 0; }