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())


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    for j in range(N + 1 - i):
        if flag == 1:
            break
        for k in range(N + 1 -  i - j):
            if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                a = i
                b = j
                c = k
                flag = 1
                break


print(str(a) +' '+ str(b) +' ' + str(c))

N,Y = map(int, input().split())


a = -1
b = -1
c = -1

flag = 0

'''
    if flag == 1:
        break
    if  Y - 10000 * i  ==0 and i==N:
        a = i
        b = 0
        c = 0
        flag = 1
'''

for i in range(N + 1):
    for j  in range(N+1- i):
        k = N - i -j
        if Y - 10000 * i - 5000 * j - 1000 * k == 0:
            a = i
            b = j
            c   = k
            flag = 1
            break


print(str(a) +' '+ str(b) +' '+ str(c))
