#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
const int C=210001;

ll a[C], F[C], pp[C], dp[C];

ll count(int aa, int b){
	return (a[b]*a[b]+dp[b]-a[aa]*a[aa]-dp[aa])/(2*(a[b]-a[aa]))+1;
}

int main(){
	int n, i, j=0, iF=0, jF=0;
	ll c, aw;
	scanf ("%d %lld", &n, &c);
	scanf ("%lld", &a[0]);
	F[0]=0, pp[0]=-100000, jF=1;
	
	for (i=1;i<n;i++){
		scanf ("%lld", &a[i]);
		for (;iF<jF-1;iF++){
			if (pp[iF]>=a[i])	break;
		}
		if (pp[iF]>a[i])	iF--;
		
		dp[i]=(a[i]-a[F[iF]])*(a[i]-a[F[iF]])+dp[F[iF]]+c;
		
		while (1){
			aw=count(F[jF-1], i);
			if (aw<=pp[jF-1])	jF--;
			else break;
			if (jF==iF)	break;
		}
		F[jF]=i;
		if (jF==iF)	pp[jF]=-100000;
		else pp[jF]=aw;
		jF++;
	}
	printf ("%lld", dp[n-1]);
	
return 0;}