#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> x(N);
    for(int i=0; i<N; i++) cin >> x[i];

    int ans = 1000000000;
    for(int i=0; i<=N-K; i++){
        ans = min(ans, abs(x[i]) + abs(x[i+K-1]-x[i]));
        ans = min(ans, abs(x[i+K-1]) + abs(x[i+K-1]-x[i]));
    }
    cout << ans << endl;
}
