Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e19

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

CX = [0] * (N+1)

#cum_sum
for i in range(N):
  CX[i+1] = CX[i] + A[i]
  
for k in range(1,N+1): # Number of robots (this loop will be ended early)
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  
  # partial point answer (not using cumulative sum)
  for i in range(1,N+1):
    cost += A[N-i] * mul[(i-1)//k]
  #ix = N
  #loopc = 0
  #while ix > 0:
  #  if ix-k > 0:
  #    cost += (CX[ix] - CX[ix-k]) * mul[loopc]
  #  else:
  #    cost += (CX[ix]) * mul[loopc]
  #  loopc += 1
  #  ix -= k
  
  #print(k,cost)
  ans = min(ans,cost)
  if N//k <= 1: # early stopping (after mul is 5 for all A's, cost is monotonicaly increasing)
    print(ans)
    exit(0)
    
#print(ans)
  
  

Fixed submission:
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e19

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

CX = [0] * (N+1)

#cum_sum
for i in range(N):
  CX[i+1] = CX[i] + A[i]
  
for k in range(1,N+1): # Number of robots (this loop will be ended early)
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  
  # partial point answer (not using cumulative sum)
  # for i in range(1,N+1):
  #  cost += A[N-i] * mul[(i-1)//k]
  ix = N
  loopc = 0
  while ix > 0:
    if ix-k > 0:
      cost += (CX[ix] - CX[ix-k]) * mul[loopc]
    else:
      cost += (CX[ix]) * mul[loopc]
    loopc += 1
    ix -= k
  
  #print(k,cost)
  ans = min(ans,cost)
  if N//k <= 1: # early stopping (after mul is 5 for all A's, cost is monotonicaly increasing)
    print(ans)
    exit(0)
    
#print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e15

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

for k in range(1,N+1): # Number of robots (this loop will be ended early)
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  for i in range(1,N+1):
    cost += A[N-i] * mul[(i-1)//k]
  #print(k,cost)
  ans = min(ans,cost)
  if N//k <= 1: # early stopping (after mul is 5 for all A's, cost is monotonicaly increasing)
    print(ans)
    exit(0)
    
#print(ans)
  
  

Fixed submission:
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e19

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

CX = [0] * (N+1)

#cum_sum
for i in range(N):
  CX[i+1] = CX[i] + A[i]
  
for k in range(1,N+1): # Number of robots (this loop will be ended early)
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  
  # partial point answer (not using cumulative sum)
  # for i in range(1,N+1):
  #  cost += A[N-i] * mul[(i-1)//k]
  ix = N
  loopc = 0
  while ix > 0:
    if ix-k > 0:
      cost += (CX[ix] - CX[ix-k]) * mul[loopc]
    else:
      cost += (CX[ix]) * mul[loopc]
    loopc += 1
    ix -= k
  
  #print(k,cost)
  ans = min(ans,cost)
  if N//k <= 1: # early stopping (after mul is 5 for all A's, cost is monotonicaly increasing)
    print(ans)
    exit(0)
    
#print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e15

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

for k in range(1,N+1): # Number of robots
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  for i in range(1,N+1):
    cost += A[N-i] * mul[(i-1)//k]
  #print(k,cost)
  ans = min(ans,cost)
  
print(ans)
  
  

Fixed submission:
N, X = map(int, input().split())
A = list(map(int, input().split()))

ans = 1e19

"""
abcdef
f +4(f-e) + 9+(e-d) + 16(d-c) + ...
= 5f + 5e + 7d + 9c + 11b + 13a
"""
mul = [5] + [5 + 2*i for i in range(N)]
#print(mul)

CX = [0] * (N+1)

#cum_sum
for i in range(N):
  CX[i+1] = CX[i] + A[i]
  
for k in range(1,N+1): # Number of robots (this loop will be ended early)
  cost = N*X + k*X # pickup and throw costs(fixed with k)
  
  # partial point answer (not using cumulative sum)
  # for i in range(1,N+1):
  #  cost += A[N-i] * mul[(i-1)//k]
  ix = N
  loopc = 0
  while ix > 0:
    if ix-k > 0:
      cost += (CX[ix] - CX[ix-k]) * mul[loopc]
    else:
      cost += (CX[ix]) * mul[loopc]
    loopc += 1
    ix -= k
  
  #print(k,cost)
  ans = min(ans,cost)
  if N//k <= 1: # early stopping (after mul is 5 for all A's, cost is monotonicaly increasing)
    print(ans)
    exit(0)
    
#print(ans)