#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 = 1e9;
  for (int i = 0; i < N-K+1; ++i) {
    int tmp = min(abs(x[i])+abs(x[i+K-1]-x[i]), abs(x[i+K-1])+abs(x[i+K-1]-x[i]));
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}