#include using namespace std; namespace { typedef double real; typedef long long ll; template ostream& operator<<(ostream& os, const vector& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } int N; ll V; vector C; void input() { cin >> N >> V; C.resize(N); for (int i = 0; i < N; i++) cin >> C[i]; } void solve() { vector S(N, 0); // [0, k]を1[L]ずつまぜたジュースのk+1[L]の値段 S[0] = C[0]; for (int i = 1; i < N; i++) { S[i] = S[i - 1] + C[i]; } V -= N; int k = N - 1; for (int i = 0; i < N; i++) { real c = real(S[i]) / (i + 1); if (c < real(S[k]) / (k + 1)) { k = i; } } const ll INF = 1LL<<56; if (V <= 0) { cout << S[N - 1] << endl; return; } ll dp[N + 1][N + 1]; for (int j = 0; j <= N; j++) dp[0][j] = 0; for (int i = 1; i <= N; i++) for (int j = 0; j < N; j++) dp[i][j] = INF; for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { dp[i][j] = dp[i][j - 1]; if (i - j >= 0) dp[i][j] = min(dp[i][j], dp[i - j][j - 1] + S[j - 1]); else dp[i][j] = min(dp[i][j], S[j - 1]); } } //for (int i = 0; i <= N; i++) cout << i << " -> " << dp[i][N] << endl; ll ans = 1LL<<56; ans = min(ans, S[k] * (V + k) / (k + 1)); for (int i = 1; i <= N; i++) { ll v = V - i; ans = min(ans, dp[i][N] + max(0LL, S[k] * ((v + k) / (k + 1)))); } cout << ans + S[N - 1] << endl; } } int main() { input(); solve(); return 0; }