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

int main(){
  int n, k;
  cin >> n >> k;

  vector<int> x(n+1, 0);
  for(int i = 1; i <= n; i++){
    cin >> x[i];
  }

  int mint = 1000000000;
  for(int l = 1; l <= n - k + 1; l++){
    int r = l + k -1;
    mint = min(x[r] - x[l] + min(abs(x[r]), abs(x[l])), mint);
  }

  cout << mint << endl;

  return 0;

}