P17319 [ICPC 2018 Nanjing R] Tournament

Description

There are $N$ villagers (including the village chief) living in Number Village. Interestingly, all of their houses lie on a straight line. The house of the $i$-th villager ($0\leq i

Input Format

The first line contains two positive integers $N,K$ ($K\leq N\leq 3\times 10^ 5$). The second line contains $N$ non-negative integers $a_0,a_1,\cdots,a_{N-1}$ ($0=a_0

Output Format

Print a single integer $\text{---}$ the minimal traffic cost rounded down to the nearest integer.