import std.stdio;
import std.algorithm;
import std.conv;
import std.string;

void main()
{
	auto tokens = split(chomp(readln()));
	auto n = to!int(tokens[0]);
	auto x = to!int(tokens[1]);
	int[] a;
	foreach (token; split(chomp(readln())))
	{
		a ~= to!int(token);
	}

	ulong moveCost(ulong hold)
	{
		 return (hold + 1) * (hold + 1);
	}

	ulong result;
	ulong hold;
	ulong pos;
	foreach (i, e; a)
	{
		auto cost1_1 = pos == 0 ? 0 : (pos * moveCost(hold) + x);
		auto cost1   = cost1_1 + e + e * moveCost(1) + x;
		auto cost2_1 = (e - pos) * moveCost(hold);
		auto cost2   = cost2_1 + e * moveCost(hold + 1) + x;
		if (cost1 <= cost2)
		{
			result += cost1;
			hold = 0;
			pos = 0;
		}
		else
		{
			result += cost2_1;
			++hold;
			pos = e;
		}
	}
	if (pos != 0) result += pos * moveCost(hold) + x;

	writeln(result);
	stdout.flush();
}