#include using namespace std; using ll = long long; int main() { int N, V, C[101]; ll cost = 0; cin >> N >> V; for (int i = 0; i < N; i++) { cin >> C[i]; cost += C[i]; } V -= N; V = max(0, V); ll sum[110] = {}; int best = 1; for (int i = 0; i < N; i++) { sum[i + 1] = sum[i] + C[i]; if (sum[i + 1] * best > sum[best] * (i + 1)) best = i + 1; } ll dp[20010] = {}; for (int i = 1; i < 20000; i++) { dp[i] = 1e11; } for (int i = 1; i <= N; i++) { for (int v = 0; v < 20000 - 200; v++) { dp[v + i] = min(dp[v + i], dp[v] + sum[i]); } } ll times = max(V - 15000, 0); times /= best; cost += times * sum[best] + dp[V - times * best]; cout << cost << endl; }