function main(input) {
  var N = input[0].split(" ")[0]-0;
  var K = input[0].split(" ")[1]-0;
  var list = input[1].split(" ").map(v=>v-0);
  var left = [];
  var right = [0];
  for(var i=0;i<N;i++){
    var v = list[i];
    if(v<0){
      left.push(v);
    }else if(v>0){
      right.push(v);
    }else{
      K--;
    }
  }
  left.push(0);
  left.reverse();
  var ans = null;
  for(var i=0;i<=K;i++){
    if(left[i] && right[K-i]){
      var a = 0;
      a+= Math.abs(left[i]*2) + Math.abs(right[K-i]);
      if(ans===null) ans = a;
      else ans = Math.min(a, ans);
    }
    if(left[K-i] && right[i]){
      var a = 0;
      a+= Math.abs(right[i]*2) + Math.abs(left[K-i]);
      if(ans===null) ans = a;
      else ans = Math.min(a, ans);
    }
    if(right[i]){
      var a = 0;
      a+= Math.abs(right[i]);
      if(ans===null) ans = a;
      else ans = Math.min(a, ans);
    }
    if(left[i]){
      var a = 0;
      a+= Math.abs(left[i]);
      if(ans===null) ans = a;
      else ans = Math.min(a, ans);
    }
  }

  if(K==0) console.log(0);
  else console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
