#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
const int inf = 1e6;
int x[maxn],n,k;
long long a[maxn],b[maxn];
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> k;
    for(int i=0;i<=n;i++)   a[i] = b[i] = inf;
    int zero = 0;
    int aa=0,bb=0;
    int light=0;
    for(int i=1;i<=n;i++){
        cin >> x[i];
        if(x[i]==0){
          light = 1;
          k = k-light;
        }
        if(x[i-1-light]<0 && x[i]>0)
            zero = i;
        if(x[i]>0)
            a[++aa] = x[i];
    }
    if(x[n]<=0){
        for(int i=n-light;i>=1;i--)
            b[++bb] = -x[i];
    }
    else{
        for(int i=zero-1-light;i>=1;i--){
            b[++bb] = -x[i];
        }
    }
    long long ans = min(a[k],b[k]);
    for(int i=1;i<=k ;i++){
        ans = min(ans,a[k-i]*2+b[i]);
        ans = min(ans,b[k-i]*2+a[i]);
    }
    cout << ans << endl;
    return 0;
}
