#Lutece2203. zh的奖杯

zh的奖杯

Migrated from Lutece 2203 zh的奖杯

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

zh有很多奖杯。一天他准备把这些奖杯打包处理。已知每个奖杯体积为vi,zh会把一些连续的奖杯打包在一个箱子里,并且在奖杯与奖杯之间塞入一个单位体积的棉花隔开。而一个箱子的制作费用为(V-L)^2。其中,L为给定的常量,V为塞入的奖杯和棉花总体积。现在,zh要把所有奖杯打包,请问费用最少是多少?

Input

第一行有2个整数n,L(1≤n≤50000,1≤L≤10^7),含义如题目所示。

接下来n行为ci代表每个奖杯的体积。(1≤ci≤10^7)

Output

输出一个整数表示zh所花费的最小费用。

Samples

5 4

3

4

2

1 

4
1

Note

请勿使用double,而使用long long。

Resources

2019 UESTC ACM Training for Dynamic Programming