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())
flag=False

for k in range(N):
    for j in range(N-k):
        for i in range(N-k-j):
            if Y==10000*i+5000*j+1000*k and N==i+j+k:
                flag=True
                print(i, j, k)
                break
        if flag:
            break
    if flag:
        break
else:
    print('-1 -1 -1')
N, Y=map(int,input().split())
flag=False

for i in range(0,N+1):
    for j in range(0, N+1):
        if Y==10000*(N-i-j)+5000*i+1000*j and i+j<=N:
            flag=True
            print(N-i-j, i, j)
            break
    if flag:
        break
else:
    print('-1 -1 -1')