INF = 1<<64 N,V = map(int,input().split()) C = list(map(int,input().split())) S = [0] * (N + 1) for i in range(N): S[i+1] = S[i] + C[i] if V <= N: print(S[N]) exit() V -= N x = 1 for i in range(2,N+1): if S[i] / i < S[x] / x: x = i K = V // x while V - (K * x) <= 20000 and K: K -= 1 V -= K * x DP = [[INF] * (V+1) for _ in range(N+1)] DP[0][0] = 0 for i in range(1,N+1): for j in range(V+1): DP[i][j] = min(DP[i-1][j], DP[i][j]) k = j - i DP[i][j] = min(DP[i][k] + S[i], DP[i][j]) print(S[x] * K + DP[N][V] + S[N])