Imports System.Collections.Generic

Module Module1
    Sub Main()
        '情報取得
        Dim N() As String = Console.ReadLine.Split(" ")
        Dim totalCount As Integer = Integer.Parse(N(0))
        Dim totalMoney As Integer = Integer.Parse(N(1))

        Dim oneCount As Integer = 0
        For tenCount As Integer = 0 To totalCount                           '枚数ループ：1万
        For fiveCount As Integer = 0 To (totalCount - tenCount)         '枚数ループ：5千円
        oneCount = totalCount - tenCount - fiveCount                '枚数：千円
        If (tenCount * 10000 + fiveCount * 5000 + oneCount * 1000) = totalMoney Then
          Console.WriteLine(tenCount & " " & fiveCount & " " & oneCount)
          Exit Sub
          End If
        Next
      Next
      Console.WriteLine("-1 -1 -1")
    End Sub
End Module
