#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
int a[100005],ans=1926081700;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
       cin>>a[i];
    for(int i=1;i<=n-k+1;i++)
    {
        ans=min(ans,abs(a[i])+abs(a[i+k-1]-a[i]));
        ans=min(ans,abs(a[i+k-1])+abs(a[i+k-1]-a[i]));
    }
    cout<<ans;
    return 0;
}