Given an array **a** consisting of **n** elements, call array **b** consisting of **n** elements such that **(a[1] — b[1])^2 + (a[2] — b[2])^2 + ... + (a[n] — b[n])^2 is minimum** and sum of all elements of array **B** is equal to **m**.↵
↵
Given n, array A, m, find the value of (a[1] — b[1])^2 + (a[2] — b[2])^2 + ... + (a[n] — b[n])^2.↵
↵
Constraints : 1 <= n <= 1e5 , 1 <= m <= 2e9, 1 <= a[i] <= 2e9↵
↵
Input : first line n,m respectively, second line is the elements of array A↵
Output : the expected value↵
↵
Ex: ↵
↵
↵
Input : 3 3↵
3 4 5↵
Output : 27↵
Input : 10 4↵
2 3 4 5↵
Output : 4
↵
Given n, array A, m, find the value of (a[1] — b[1])^2 + (a[2] — b[2])^2 + ... + (a[n] — b[n])^2.↵
↵
Constraints : 1 <= n <= 1e5 , 1 <= m <= 2e9, 1 <= a[i] <= 2e9↵
↵
Input : first line n,m respectively, second line is the elements of array A↵
Output : the expected value↵
↵
Ex: ↵
↵
↵
Input : 3 3↵
3 4 5↵
Output : 27↵
Input : 10 4↵
2 3 4 5↵
Output : 4