def solve(N, V, C): A = [0] * N A[0] = C[0] for i in range(1, N): A[i] = A[i - 1] + C[i] R = [(a / (i + 1), i) for i, a in enumerate(A)] R.sort() L = [0] * N L[N - 1] = 1 cost = A[-1] V -= N if V <= 0: return cost r0 = R[0][1] s = V // (r0 + 1) s -= r0 + 1 v = V - s * (r0 + 1) cost += A[r0] * s # cost 円使って残り v リットル DP = [2 ** 63] * (v + 1) DP[0] = 0 for i in range(v): for j in range(N): if i + j + 1 <= v: DP[i + j + 1] = min(DP[i + j + 1], DP[i] + A[j]) return DP[-1] + cost def main(): N, V = list(map(int, input().split())) C = list(map(int, input().split())) print(solve(N, V, C)) if __name__ == '__main__': main()