#include<iostream>
using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  int x[N];
  for(int i=0;i<N;++i) cin >> x[i];
  int dist=min(abs(x[0])+x[K-1]-x[0],abs(x[K-1])+x[K-1]-x[0]);
  for(int i=1;i<N-K+1;++i){
    int d=min(abs(x[i])+x[K-1+i]-x[i],abs(x[K-1+i])+x[K-1+i]-x[i]);
    if(dist>d) dist=d;
  }
  cout << dist << endl;
  return 0;
}
