/* `
`` `
. ` .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 mi = 0;
rep(i, 1, N) {
// C[i] / L[i] < C[mi] / L[mi]
if (C[i] * L[mi] < C[mi] * L[i]) mi = i;
}
makedp(N * N);
ll rest = V % (L[mi] * L[mi]);
ans += 1LL * (V - rest) * C[mi] / L[mi];
ans += dp[rest];
cout << ans << endl;
}