#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,a[N];
int get(int x) {
	return a[x+k-1]-a[x]+min(abs(a[x+k-1]),abs(a[x]));
}
int main() {
	int re=1e9;
	cin>>n>>k;
	for (int i=1;i<=n;++i) cin>>a[i];
	for (int i=1;i<=n-k+1;++i) re=min(re,get(i));
	cout<<re;
}