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 = sum(C) V -= N if V <= 0: return cost r0 = R[0][1] d = V // (r0 + 1) d -= r0 v = V - d * (r0 + 1) cost += A[r0] * d DP = [2 ** 63] * (v + 1) DP[0] = 0 for i in range(v): for j in range(r0 + 1): if i + j + 1 <= v: DP[i + j + 1] = min(DP[i + j + 1], DP[i] + A[j]) return DP[v] + 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()