#include<iostream>
 
using namespace std;
int main()
{
	int n,k;
	long long ans=2e15,x[100010];
	cin >> n >> k;
	for(int i=0; i<n; i++){
		cin >> x[i];
	}
	for(int i=0; i+k-1<n; i++){
		int l = i, r = i+k-1;
		ans = min(ans, x[r]-x[l] + min(abs(x[r]), abs(x[l])));
	}
	
	cout << ans << endl;
	
	return 0;
}
