The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.  According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a total of Y yen, but he may be lying. Determine whether such a situation is possible, and if it is, find a possible set of bills contained in the envelope. Assume that his grandfather is rich enough, and the envelope was large enough.
n, y = map(int, input().split())

def waru(num, satsu):
    a, b = divmod(num, satsu)
    return a, b


answer = [0, 0, 0]
wrong = [-1, -1, -1]

satu = 10000
i = 0
while n >= 0 and i < 3:
    ans, div = waru(y, satu)
    answer[i] = ans
    n -= ans
    y -= ans*satu
    i += 1
    if i == 1:
        satu = 5000
    elif i == 2:
        satu = 1000

if n < 0:
    print(*wrong)
else:
    print(*answer)

n, y = map(int, input().split())

noguchi = 1000
higuchi = 5000
yukichi = 10000

ans = '-1 -1 -1'
for i in range(n+1):
    for j in range(n+1-i):
        k = n - (i+j)
        yen = noguchi * i + higuchi * j + yukichi * k
        if yen == y:
            ans = '{0} {1} {2}'.format(k,j,i)
            break

print(ans)
