#include <iostream>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int n,k,ans=1000000000,m=-1,p=-1;
int x[100000];
int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=0;i+k-1<n;i++){
        ans=min(ans,abs(x[i]-x[i+k-1])+min(abs(x[i]),abs(x[i+k-1])));
    }
    cout<<ans;
}