#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBERS(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

ll Earliest(ll N, ll K, vector<ll> Xs)
{
    vector<ll> ret(N-K+1);
    for(ll i=0;i<N-K+1;i++)
    {
        if(Xs[i+K-1]<=0)
        {
            ret[i] = abs(Xs[i]);
        }
        else if(Xs[i]<=0)
        {
            ret[i] = abs(Xs[i]-Xs[i+K-1]) + min(abs(Xs[i]),Xs[i+K-1]);
        }
        else
        {
            ret[i] = Xs[i+K-1];
        }
    }
    return *min_element(ALL(ret));
}

int main()
{
    ll N,K;
    cin >> N >> K;

    vector<ll> Xs(N);
    ALLIN1_NUMBERS(Xs);

    OUT0(Earliest(N,K,Xs));

    return 0;
}
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a)
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a)
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll sum(ll n) {
	return (1 + n) * n / 2;
}
//1から整数nまでの合計
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double m = sqrt(a);
	for (int i = 3; i <= m; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定

// ===============================================================

int main() {
	ll n, m; cin >> n >> m;
	bool ans = false;
	for (ll i = 0; i < n+1; i++) {
		for (ll j = 0; j < n+1; j++) {
			if (i + j <= n) {
				if (i * 1000 + j * 5000 + (n - i - j) * 10000 == m) {
					cout << n - i - j << " " << j << " " << i << endl;
					ans = true;
					break;
				}
			}
		}
		if (ans) break;
	}
	if (ans == false) {
		cout << -1 << " " << -1 << " " << -1 << endl;
	}
}