#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> line;
#define m first
#define b second
const int MN = 2e5+5;
line lines[MN];
ll h[MN];
ll get (line a, ll x) {return a.m * x + a.b;}
double intersect (line f, line s) {return f.m == s.m ? -1e18 : (f.b - s.b)/double(s.m - f.m);}
int main() {
    int n,l=0,r=1; ll c;
    scanf ("%d %lld %lld",&n,&c,&h[0]);
    lines[0] = {-2 * h[0],h[0] * h[0]};
    for (int i = 2; i <= n; i++) {
        scanf ("%lld",&h[i]);
        while (r-l>1 && get(lines[l],h[i]) >= get(lines[l+1],h[i])) l++;
        ll dp = get(lines[l],h[i]) + h[i] * h[i] + c;
        if (i == n) return !printf ("%lld\n",dp);
        line nline = {-2 * h[i],dp + h[i] * h[i]};
        while (r-l>1 && intersect(nline,lines[r-1]) < intersect(lines[r-1],lines[r-2])) r--;
        lines[r++] = nline;
    }
    return 0;
}