n, v = map(int, input().split()) C = list(map(int, input().split())) ans = sum(C) v -= n if v <= 0: print(ans) exit() for i in range(1, n): C[i] += C[i - 1] D = [c / i for i, c in enumerate(C, 1)] i = D.index(min(D)) if v >= 20000: x = (v - 20000) // (i + 1) ans += x * C[i] v -= x * (i + 1) dp = [1 << 60] * (v + 1) dp[0] = 0 for i, c in enumerate(C, 1): for j in range(i, v + 1): dp[j] = min(dp[j], dp[j - i] + c) ans += dp[-1] print(ans)