#include <bits/stdc++.h>
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define ll long long
using namespace std;

const int N = 1e5+10;

ll a[N];


int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    int n,k;
    cin>>n>>k;
    int flag=0;
    ll minn=1e9;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(minn>abs(a[i])){minn=abs(a[i]);flag=i;}
    }
    if(a[1]>=0){cout<<a[k]<<endl;return 0;}
    if(a[n]<=0){cout<<a[n-k+1]<<endl;return 0;}
    if(n==k&&a[1]+a[n]>=0){cout<<a[n]-2*a[1]<<endl;return 0;}
    if(n==k&&a[1]+a[n]<0){cout<<2*a[n]-a[1]<<endl;return 0;}
    if(k==1){cout<<abs(a[flag])<<endl;return 0;}
    if(flag-k>=0&&a[flag-k+1]+a[flag+1]>=0){cout<<a[flag-k+1]<<endl;return 0;}
    if(flag+k<=n&&a[flag+k]+a[flag]<=0){cout<<a[flag+k]<<endl;return 0;}
    if(k==2){
        a[flag]=-a[flag];
        cout<<min(2*a[flag]+a[flag+1],a[flag]+2*a[flag+1])<<endl;return 0;}

    int ff=flag;
    int b=0;
    while(k-2>0){
        while(a[flag]+a[ff+1]>0){

            if(flag>1){
                flag--;
                k--;
            }
            else{
                b=1;
                break;
            }
        }
        if(b==1){
            ff++;
            k--;
        }
        while(a[flag]+a[ff+1]<=0){
            if(ff<n-1){
            ff++;
            k--;
            }
            else{
            b=2;
            break;
            }
        }
        if(b==2){
            flag--;
            k--;
        }

    }
    if(a[ff+1]+a[flag]>=0){cout<<a[ff+1]-2*a[flag]<<endl;return 0;}
    if(a[ff+1]+a[flag]<0){cout<<2*a[ff+1]-a[flag]<<endl;return 0;}
    return 0;
}
