/* `
`` `
. ` .g,`
Welcome To My Coding Space! .MMe `(F(#~ `.J,
`.M/7b. dD.N; (#=#:
`` db (m.#` Wl(@ jF `
`` ` ` ` ..+kMMN;_(Y> `(TD d$..gHN_
` `` ...... ` ` ` `..gMB61+1+dK `- `. .TM@^(d%
`` `` ..JggHHMMHHYYTHMMMNmgJ.. .kB6z?1+z1+
+H8+=??=?=?=???=?=?=z1&z1?==?1dM?===?=?=?+dNy+?=?jM@ ` ?WNe+zO>dNcHmJ1+1JMMR1?z??Ne1dM9+?(MF(MI+jMf .`.``.`.. (TNaHr`.`.TNmN:(MR+?zMK(M$` `.`.``dF `
J#<=1;?Wp .``.` J#>dN, ..``.`dF`
`_UmMn .`..`..`..`. JMYT1<;;;>>>>>;>>?Wo ..`. dK1=dN,`..``.MN+
.dMMe .`.``.`.`.` d#<;>>>>;>>>>;>>>>(N,`.. -MK1llvWm. JM?Mp. ` `
` .M9+?Me`.`..`.`.`` JN(>;>>;>>;>>>;>>>>>>>;>>>>>;>>>>>>>>>>>>>>><(W$(M8TIllllllllllllllllzvMo ` ` `
(#1?==1?===z?TNa,.` `` (Ne<<>>>>><;><;jgMMY1HK1lllllllllllllllllllJMp `
.Ne&g&x1=?=?==?1zTHNmJ-...dNgJ++++&ggMH9=~ .M9Izlllllllllllllllllll1WF `
` _???MK<=??=??1z?(MM@!d#M#Y""""=
#define rep(i,a,b) for(int i=a;i> N >> V;
rep(i, 0, N) cin >> C[i];
ll sm = 0;
rep(i, 0, N) sm += C[i];
if (V <= N) {
cout << sm << endl;
return;
}
ll ans = sm;
V -= N;
reduction();
int opt = 1;
rep(i, 2, N + 1) {
if (sum[opt] * i > sum[i] * opt) opt = i;
}
makedp(N * N);
/*ll rest = V % (L[opt] * L[opt]);
ans += 1LL * (V - rest) / L[opt] * C[opt];
ans += dp[rest];*/
ll k = max(0LL, (V - N*N) / opt);
ans = k * sum[opt] + dp[V - k * opt] + sm;
cout << ans << endl;
}