#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int n,k;const int maxn=1e+5+5;
int aa[maxn];
int main(){
	scanf("%d%d",&n,&k);
	rep(i,1,n)scanf("%d",aa+i);
	int ans=0x3f3f3f3f;
	rep(i,1,n){
		int j=i+k-1;
		if(j>n)break;
		int x=abs(aa[i]),y=abs(aa[j]);
		if((aa[j]<0)^(aa[i]<0))ans=min(ans,min(x*2+y,x+2*y));
		else ans=min(ans,max(x,y));
	}
	cout<<ans<<endl;
	return 0;
}
