409024: GYM103416 D Delivery
Description
You are given a sequence of delivery points $$$x$$$ of length $$$n$$$ and the integer number $$$k$$$.
Delivery point is an integer number $$$x_i$$$ in the range of $$$[-10^9; 10^9]$$$ (i.e. $$$-10^9 \le x_i \le 10^9$$$).
Find the minimum distance of delivering any $$$k$$$ orders. Initially you are at origin $$$0$$$.
The distance between $$$x_i$$$ and $$$x_j$$$ is the absolute difference between them |$$$x_i$$$ - $$$x_j$$$|.
InputThe first line of the input contains integer numbers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^6$$$, $$$1 \le k \le n$$$).
The second line of the input contains $$$n$$$ integer numbers $$$x_1, x_2, \dots, x_n$$$ ($$$-10^9 \le x_i \le 10^9$$$).
OutputPrint the minimum distance of delivering any $$$k$$$ orders.
ExampleInput4 3 -5 -4 3 7Output
11Note
The path (0, 3, -4, -5) gives the minimum distance: |3-0|+|-4-3|+|-5-(-4)| = 11