#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 100;
bool was[N] ;
int  x[N] , n  , X , dp[4000];	

main(){
	cin >> n >> X;
	for(int i = 1 ; i <= n ; i++)
		cin >> x[i];
	dp[1] = X + X + x[1] + x[1] * (2) * 2;
	for(int i = 2 ; i <= n ; i++){
		int cost = x[i];
		dp[i] = 1000000000000000000ll;
		for(int j = i; j > 0 ; j--){
			if(cost > 1e18 - ((x[min(j + 1 , i)] - x[j]) * (i - j + 1) * (i - j + 1) + X))
				break;
			cost += ((x[min(j + 1 , i)] - x[j]) * (i - j + 1) * (i - j + 1) + X);
			
			int tmp = dp[j - 1] + cost + x[j] * (i - j + 2) * (i - j + 2) + X;
			dp[i] = min(tmp , dp[i]);
		}
	}
	cout << dp[n];
}