#d11307. 变量
变量
Variables
Problem Description
You are given integer constants and an integer . You must assign integer values to variables such that:
- For all , we have .
- For all , there exists at least one () such that .
Find the minimum possible value of $S = (y_1 + y_2 + \dots + y_k) - (x_1 + x_2 + \dots + x_k)$.
Input Format
The first line contains two integers and .
The next line contains integers .
Output Format
One integer: the minimum value of .
Sample Input
5 2
-5 0 10 4 0
Sample Output
9
Constraints
There are 10 test points in total.
Test points 1, 2: , .
Test points 3, 4, 5: .
For all data, and .
Hint
See the attached files.