#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int a[100000];

int main(void){
    int n, k;

    cin >> n >> k;

    int id = -1;

    for (int i = 0; i < n; i++){
        cin >> a[i];
        if (id == -1 && a[i] > 0)
            id = i;

    }


    int m = 1e9;


    for (int i = 0; i <= k; i++){
        if (id >= k - i && i <= n - id){
            if (i == 0){
                m = min(m, abs(a[id - k]));
            }
            else if (i == k){
                m = min(m, abs(a[id+k - 1]));
            }
            else {
                m = min(m, min(2*abs(a[id+i-1]) + abs(a[id-k+i]), abs(a[id+i-1]) + 2*abs(a[id-k+i])));
            }
        }
    }

    cout << m << endl;
}
