#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define ALL(a)     (a).begin(),(a).end()
#define EACH(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c)    sort((c).begin(),(c).end())
#define RSORT(c)    sort((c).rbegin(),(c).rend())
#define MAXINDEX(c) distance((c).begin(),max_element((c).begin(),(c).end()))
#define MININDEX(c) distance((c).begin(),min_element((c).begin(),(c).end()))
#define DEBUG(x)   std::cerr <<#x<<" = "<<(x)<<" ("<<__FILE__<<"::"<<__LINE__<<")"<<std::endl;
#define ERROR(s)   std::cerr <<"Error::"<<__FILE__<<"::"<<__LINE__<<"::"<<__FUNCTION__<<"::"<<(s)<<std::endl;
#define FOR(i,a,b) for (auto i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)

constexpr bool __debugFlag = false;

int searchIndexOfminus2plus(std::vector<int> v){
    for( size_t i = 0; i < v.size()-1 ; i ++  ) {
        if (v[i] < 0 && v[i+1] >= 0) {
            return i;
        }
    }
    return -1;
} 

int main(int argc, char **argv){
    
    // get inputs 
    size_t numberOfCandle;
    size_t numberOfLight;

    cin >> numberOfCandle >> numberOfLight;
    
    vector <int> candleCordinates( numberOfCandle ); 
    for(size_t i=0; i<numberOfCandle; i++) {
        cin >> candleCordinates[i] ;
    }

    if( candleCordinates[0] >= 0 &&  candleCordinates[numberOfCandle-1] > 0  ) {
        cout << candleCordinates[numberOfLight-1] << endl;
        return 0;
    } else if( candleCordinates[0] < 0 &&  candleCordinates[numberOfCandle-1] <= 0  ) {
        cout << -candleCordinates[ numberOfCandle - numberOfLight] << endl;
        return 0;
    }

    // int indexOfminus2plus = searchIndexOfminus2plus( candleCordinates );
    
    // int headIndex_start = indexOfminus2plus - numberOfLight;
    // if( headIndex_start < 0) {
    //     headIndex_start = 0;
    // }
    // int headIndex_end = indexOfminus2plus+1; // 0が存在する場合+1が必要 めんどいので一律+1
    // if( headIndex_end + numberOfLight >= numberOfCandle){
    //     headIndex_end = numberOfCandle - numberOfLight ;
    // } 

    int64_t globalMinTime = 1ll << 62;
    for(size_t i=0; i<=numberOfCandle-numberOfLight; i++){
        int beginValue = candleCordinates[i];
        int64_t minusSideTime = beginValue < 0 ? abs(beginValue) : 0;

        int endValue = candleCordinates[i + numberOfLight - 1];
        int64_t plusSideTime = endValue > 0 ? abs(candleCordinates[i + numberOfLight - 1]) : 0;

        int64_t localMinTime = min ( 2 * minusSideTime + plusSideTime , minusSideTime + 2 * plusSideTime ) ;
        globalMinTime = min ( globalMinTime , localMinTime) ;       
    }   


    // int64_t globalMinTime = 2 * 100000;
    // for(int i=headIndex_start; i<=headIndex_end; i++) {
    //     int64_t minusSideTime = abs(candleCordinates[i]);
    //     int64_t plusSideTime = abs(candleCordinates[i + numberOfLight - 1]);
    //     int64_t localMinTime = min ( 2 * minusSideTime + plusSideTime , minusSideTime + 2 * plusSideTime ) ;
    //     globalMinTime = min ( globalMinTime , localMinTime) ;
    // }

    // if(__debugFlag ){
        
    //     cout << "N," << numberOfCandle << ",K,"  << numberOfLight << endl;
    //     for(size_t i=0; i<numberOfCandle; i++) {
    //         cout << candleCordinates[i] << ",";
    //     }
    //     cout << endl;
    //     cout << indexOfminus2plus << endl;
    //     cout << headIndex_start << "," << headIndex_end << endl;
    // }

    cout << globalMinTime << endl;
    return 0;
}


Measured memory_bytes: 640