module.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){e(1)(e(2).readFileSync("/dev/stdin","UTF-8"))},function(t,r){function e(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=[],n=!0,o=!1,u=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done)&&(e.push(i.value),!r||e.length!==r);n=!0);}catch(t){o=!0,u=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return e}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}t.exports=function(t){for(var r=t.split("\n"),n=e(r[0].split(" ").map(function(t){return Number(t)}),2),o=n[0],u=n[1],i=r[1].split(" ").map(function(t){return Number(t)}),a=999999999,f=0;f<o-u+1;f++){var l=f+u-1,c=i[f],p=i[l],s=Math.abs(p-c),d=Math.abs(c)+s,y=Math.abs(p)+s,b=Math.min(y,d);a=Math.min(a,b)}console.log(a)}},function(t,r){t.exports=require("fs")}]);