#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=100010;
int ara[N];
int main()
{
    IOS;
    int n,k;cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>ara[i];
    int ans=inf;
    for(int i=k;i<=n;i++)
    {
        if(ara[i]>0&&ara[i-k+1]<0){
            int sum=ara[i]-ara[i-k+1];
            int f1=sum+ara[i];
            int f2=sum-ara[i-k+1];
//            cout<<i<<" "<<f1<<" "<<f2<<endl;
            ans=min(ans,min(f1,f2));
        }
        else
        {
            int sum;
            if(ara[i]<0)sum=abs(ara[i-k+1]);
            else sum=ara[i];
            ans=min(ans,sum);

        }
    }
    cout<<ans<<endl;
}


/*
8 7
-10 -4 -2 0 5 6 8 13

8 5
-15 -12 -8 -7 -4 -1 8 15
*/




#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll dx[8]={0,0,-1,1,-1,1,-1,1};
ll dy[8]={1,-1,0,0,1,1,-1,-1};
vector<vector<ll> > c(10,vector<ll>(10,0));

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,K; cin>>N>>K;
    vector<ll> minus;
    vector<ll> plus;
    vector<ll> zero;
    rep(i,N){
        ll x; cin>>x;
        if(x<0) minus.pb(x);
        else if(x==0) zero.pb(x);
        else plus.pb(x);
    }
    ll m=sz(minus),p=sz(plus),need=K-sz(zero);
    minus.pb(0);
    plus.pb(0);
    sort(all(minus),greater<ll>());
    sort(all(plus));
    
    ll ans=INF;
    rep(i,min(need,m)+1){
        if(need-i > p) continue;
        ll X=-minus[i];
        ll Y=plus[need-i];
        
        chmin(ans,max(X,Y)+min(X,Y)*2);
    }
    cout<<ans<<endl;
}
