#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n, k = map(int, input().split())\n"
"x = list(map(int, input().split()))\n"
"i = 0\n"
"while i < n and x[i] < 0:\n"
"    i += 1\n"
"jl = i - 1\n"
"cl = []\n"
"cr = []\n"
"for l in range(k):\n"
"    if jl - l < 0:break\n"
"    cl.append(-x[jl - l])\n"
"for l in range(k):\n"
"    if i + l >= n:break\n"
"    cr.append(x[i + l])\n"
"la = 10**18\n"
"lb = 10**18\n"
"for l in range(len(cl)):\n"
"    c = k - l - 2\n"
"    if c >= len(cr):continue\n"
"    if c < 0:\n"
"        la = min(la, cl[l])\n"
"    else:\n"
"        la = min(la, cl[l] + cr[c] * 2)\n"
"for l in range(len(cr)):\n"
"    c = k - l - 2\n"
"    if c >= len(cl):continue\n"
"    if c < 0:\n"
"        lb = min(lb, cr[l])\n"
"    else:\n"
"        lb = min(lb, cr[l] + cl[c] * 2)\n"
"print(min(la, lb))\n"
"\"";
  system(s);
  return 0;
}            