n, x = map(int, input().split())

a = list(map(int, input().split()))

def score(a, m, x):
    ans = x*(n+m)
    l = n//m
    for i in range(n):
        t = (n-1-i)//m
        if i < m:
            ans += ((t+2)**2) * a[i]
        else:
            ans += ((t+2)**2) * (a[i] - a[i-m])
    for i in range(m):
        ans += a[n-1-i]
    return ans
        
def search(left, right, l_score, r_score, a, x):
    tri = (right-left)//3
    u_score = score(a, left+tri, x)
    v_score = score(a, left+tri*2, x)
    if right-left <= 3:
        return min(u_score, v_score, l_score, r_score)
    elif l_score < u_score:
        return search(left, left+tri, l_score, u_score, a, x)
    elif r_score < v_score:
        return search(left+tri*2, right, v_score, r_score, a, x)
    elif u_score < v_score:
        return search(left, left+tri*2, l_score, v_score, a, x)
    else:
        return search(left+tri, right, u_score, r_score, a, x)
    
    
def sub_search(r, a, x):
    ans = score(a, r//2+1, x)
    #print(ans)
    for i in range(r//2):
        j = r//2 - i
        ddd = score(a, j, x)
        #print(ddd)
        if ddd <= ans:
            ans = ddd
        else:
            break
    return ans
    
    
#k = search(1, n, score(a, 1, x), score(a, n, x), a, x)
k = sub_search(n, a, x)
print(k)