#include #define rep(i,n) for(int i=0;i<(int)n;i++) #define all(c) (c).begin(),(c).end() #define mp make_pair #define pb push_back #define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++) #define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)< vi; typedef pair pi; const int inf = (int)1e9; const double INF = 1e12, EPS = 1e-9; const int MX = 500000; int n, v; ll dp[MX + 10000], c[110]; int main(){ cin >> n >> v; rep(i, n) cin >> c[i + 1], c[i + 1] += c[i]; vector> p; rep(i, n) p.pb(mp(i + 1, c[i + 1])); sort(all(p), [](pair a, pair b){ return a.second * b.first < b.second * a.first; }); if(v <= n){ cout << c[n] << endl; return 0; } v -= n; rep(i, MX + 10000) dp[i] = 1e18; dp[0] = 0; rep(i, MX){ for(int j = 1; j <= n; j++) dp[i + j] = min(dp[i + j], dp[i] + c[j]); } if(v <= MX) cout << dp[v] + c[n] << endl; else{ //assert(0); ll a = p[0].first, b = p[0].second; int x = MX - a + v % a; assert((v - x) % a == 0); cout << dp[x] + (v - x) / a * b + c[n] << endl; } //rep(i, n + 1) cerr<