#include <bits/stdc++.h>
using namespace std;
const int mod = 1e8;
struct Bignum {
    long long x[5];
    Bignum(long long v = 0) {
        for (int i = 0; i < 5; i ++)x[i] = 0;
        while (v) x[++ x[0]] = v % mod, v /= mod;
    }
}ans, v, e, f2[1000000], f1[1000000];

long long m, n;
long long a[1000000];
Bignum operator + (Bignum a, long long v) {
    Bignum b = e;
    b = Bignum(v);
    a.x[0] = max(a.x[0], b.x[0]);
    for (int i = 1; i <= a.x[0]; i ++) {
        a.x[i] += b.x[i];
        if (a.x[i] >= mod) a.x[i + 1] += a.x[i] / mod, a.x[i] %= mod;    
    }
    if (a.x[a.x[0] + 1])
        a.x[0] ++;
    return a;
}

Bignum operator + (Bignum a, Bignum b) {
    a.x[0] = max(a.x[0], b.x[0]);
    for (int i = 1; i <= a.x[0]; i ++) {
        a.x[i] += b.x[i];
        if (a.x[i] >= mod) a.x[i + 1] += a.x[i] / mod, a.x[i] %= mod;    
    }
    if (a.x[a.x[0] + 1])
        a.x[0] ++;
    return a;
}


Bignum operator - (Bignum a, Bignum b) {
    for (int i = 1; i <= a.x[0]; i ++) {
        a.x[i] -= b.x[i];
        if (a.x[i] < 0) a.x[i + 1] --, a.x[i] += mod;    
    }
    while (!a.x[a.x[0]] && a.x[0]) a.x[0] --;
    return a;
}


Bignum operator - (Bignum a, long long v) {
    Bignum b = e;
    b = Bignum(v);
    for (int i = 1; i <= a.x[0]; i ++) {
        a.x[i] -= b.x[i];
        if (a.x[i] < 0) a.x[i + 1] --, a.x[i] += mod;    
    }
    while (!a.x[a.x[0]] && a.x[0]) a.x[0] --;
    return a;
}

Bignum operator * (Bignum a, long long v) {
    for (int i = 1; i <= a.x[0]; i ++)
        a.x[i] *= v;
    for (int i = 1; i <= a.x[0]; i ++)
        if (a.x[i] >= mod) a.x[i + 1] += a.x[i] / mod, a.x[i] %= mod;    
    while (a.x[a.x[0]] >= mod) {
        a.x[a.x[0] + 1] = a.x[a.x[0]] / mod;
        a.x[a.x[0]] %= mod;
        a.x[0] ++;
    }
    return a;
}

bool operator < (Bignum a, Bignum b) {
    if (a.x[0] < b.x[0]) return 1;
    if (a.x[0] > b.x[0]) return 0;
    for (int i = a.x[0]; i ; i --) 
        if (a.x[i] < b.x[i]) return 1;
        else
        if (a.x[i] > b.x[i]) return 0;
    return 0;
}
Bignum get(long long l, long long r) {
    long long len1 = r - l + 1; 
    Bignum v = Bignum(0);
    
        v = v + ((r - l + 2) * m) + a[r];
        v = v + f2[r] + (Bignum(a[l - 1] * (len1 + 1)) * (len1 + 1)) - (f2[l - 1] + (f1[l - 1] * len1 * 2) + (Bignum(a[l - 1] * len1) * len1));
    return v;
}
void work(int len) {
    for (int i = 0; i <5; i ++) v.x[i] = 0;
    long long r = n, sum = 2;
    while (r >= 1) {
        long long l = r - len + 1;
        l = max(l, 1ll);
        if (r == n) {
            v = v + Bignum((a[r] - a[l - 1])) * sum * sum;
            v = v + (r - l + 1) * m + (a[r] - a[l - 1]); 
        } else {
            v = v + Bignum((a[r] - a[l - 1])) * (sum + sum - 1);
            
        } 
        sum ++;
        r = l - 1;
    } 
    v = v + (m * n);
    if (v < ans) ans = v;
}
int main() {
    scanf("%lld %lld", &n, &m);
    for (int i = 1; i <= n ; i ++) {
        int x;
        scanf("%d", &x);
        a[i] = x + a[i - 1];
    }
    ans.x[0] = 4;
    ans.x[19] = 1e8;
    for (int i = 1; i <= n ; i ++)
        work(i);
    int x;
    printf("%lld", ans.x[ans.x[0]]);
    for (int i = ans.x[0] - 1; i >= 1; i --) {
        x = mod / 10;
        while (x) {
            printf("%lld", ans.x[i] / x % 10);
            x /= 10;
        }
    }
    return 0;
}

Measured memory_bytes: 81664