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.
nums = input()
nums = nums.split()
satu_num = int(nums[0])
sum_money = int(nums[1])

judge = True
count_one = -1
count_two = -1
count_three = -1

for a in range(0,satu_num+1):
  man = 10000*a
  for b in range(0,satu_num+1):
    go_senn = 5000*b
    senn = 1000*(satu_num-a-b)
    if senn<0:
      break
    else:
      ans = man+go_senn+senn
      if ans == sum_money:
        count_one += a+1
        count_two += b+1
        count_three += (satu_num-a-b)+1
        break
      else:
        pass
print(count_one,count_two,count_three)
     
nums = input()
nums = nums.split()
satu_num = int(nums[0])
sum_money = int(nums[1])

judge = True
count_one = -1
count_two = -1
count_three = -1

for a in range(0,satu_num+1):
  man = 10000*a
  for b in range(0,satu_num+1):
    go_senn = 5000*b
    senn = 1000*(satu_num-a-b)
    if satu_num-a-b<0:
      break
    else:
      ans = man+go_senn+senn
      if ans == sum_money:
        count_one = a
        count_two = b
        count_three = (satu_num-a-b)
        break
      else:
        pass
print(count_one,count_two,count_three)