#include <iostream>
#include<algorithm>
using namespace std;

int main() {
	int n, k, x[100010], answer = 1e9;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n - k + 1; i++) {
		answer = min(min(abs(x[i]), abs(x[i + k - 1])) + abs(x[i] - x[i + k - 1]), answer);
	}
	cout << answer << endl;
	return 0;
}