
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

} import java.util.Scanner; Scanner java.util public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

} Main public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int y = sc.nextInt()/1000; y sc.nextInt()/1000 sc.nextInt() sc.nextInt sc 1000 for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		} int tenk = 0; int tenk = 0; tenk 0 tenk <= n tenk n tenk++ tenk++ tenk {
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		} {
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		} int remon = y - (tenk*10); remon y - (tenk*10) y (tenk*10) tenk 10 int bills = n - tenk; bills n - tenk n tenk int min = bills; min bills int max = bills*5; max bills*5 bills 5 if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			} remon >= min && remon <= max && (remon-min)%4 == 0 remon >= min && remon <= max && (remon-min)%4 == 0 remon >= min remon min remon <= max remon max (remon-min)%4 == 0 (remon-min)%4 (remon-min) remon min 4 0 {
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			} int a = (remon - min)/4; a (remon - min)/4 (remon - min) remon min 4 int b = bills - a; b bills - a bills a System.out.println(tenk + " " + a + " " + b) System.out.println System.out System System.out tenk + " " + a + " " + b " " a tenk + " " + a + " " + b tenk " " a " " b return; System.out.println("-1 -1 -1") System.out.println System.out System System.out "-1 -1 -1" String[] args args public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

} public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

} Main

import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int y = sc.nextInt()/1000;
		
		for(int tenk = 0; tenk <= n; tenk++)
		{
			int remon = y - (tenk*10);
			
			int bills = n - tenk;
			
			int min = bills;
			int max = bills*5;
			//min, min+4, min+8, ..., max-4, max
			
			if(remon >= min && remon <= max && (remon-min)%4 == 0)
			{
				int a = (remon - min)/4;
				int b = bills - a;
				System.out.println(tenk + " " + a + " " + b);
				return;
			}
		}
		
		System.out.println("-1 -1 -1");
	}

}
