#include<bits/stdc++.h>
#include<cassert>
#include<numeric>

using namespace std;
typedef long long ll;
typedef long double ld;
using graph = vector<vector<int>>;
using pii = pair<int,int>;
using pll =pair<ll,ll>;
using qd = priority_queue<int,vector<int>, greater<int>>;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define F(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define sd(x) sort(x.rbegin(),x.rend())
//xにはvectorなどのコンテナ
#define all(x) (x).begin(),(x).end()
#define size(x) ((ll)(x).size())
#define ma(x) *max_element(all(x))
#define mi(x) *min_element(all(x))
#define so(x) sort(all(a));

#define INF 1000000000000
#define M 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fi(x,y) find(all(x),y)!=x.end()
template<class T> inline bool chmax(T &a,T b) { if (a<b) { a=b; return true; } return false; }
template<class T> inline bool chmin(T &a,T b) { if (b<a) { a=b; return true; } return false; }

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define bit(n) (1LL<<(n))
#define U(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define fe(x,a) for(auto& (x) : (a) )
#define vin(x) for(auto&youso_: (x) )cin>>youso_
#define vout(x) for(auto&youso_: (x) )cout<<youso_<<" "
#define sco(x) cout<<(x)<<" "
#define co(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define ci(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define di(...) double __VA_ARGS__;CINT(__VA_ARGS__)
#define lci(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define sci(...) string __VA_ARGS__;CINT(__VA_ARGS__)



struct uf {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> rcount;

    uf(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

};
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

int pow(int a, int b, int m)
{
   int ans=1;
   while(b)
   {
      if(b&1)
         ans=(ans*a)%m;
      b/=2;
      a=(a*a)%m;
   }
   return ans;
}

const int MOD = 998244353;
using mint = Fp<MOD>;

#define g0(i) get<0>(t[i])
#define g1(i) get<1>(t[i])
#define g2(i) get<2>(t[i])

void y(ll a,int i,int n,vector<tuple<int,int,int>> t){
	ll time;
	if(i==n-1)cout<<a<<endl;
	else {
		if(a<g1(i))time=g1(i)+g0(i);
		else if(a%g2(i)!=0)time=(a/g2(i)+1)*g2(i)+g0(i);
		else time=a+g0(i);
		y(time,i+1,n,t);
	}

}

int main() {
	ci(n,k);
	vector<ll>a(n);
	vin(a);
	if(!(fi(a,0))){
		a.pb(0);
		n++;
		k++;
	}
	so(a);
	ll ans=9223372036854775807;
	rep(i,n-k+1){
		if(a[i]>0||a[i+k-1]<0)continue;
		chmin(ans,2*abs(a[i])+a[i+k-1]);
		chmin(ans,abs(a[i])+2*a[i+k-1]);
	}
	co(ans);
}


Measured memory_bytes: 1792