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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (auto&& e : v) cin >> e;
  int ans = numeric_limits<int>::max();

  for (int i = 0, j = i + k - 1; j < n; i++, j++) {
    ans = min(ans, v[j] - v[i] + min(int(abs(v[i])), int(abs(v[j]))));
  }
  cout << ans << endl;
}
