using System;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {


            string s = Console.ReadLine();
            int[] nums = Array.ConvertAll(s.Split(' '), int.Parse);
            int n = nums[0];
            int a = nums[1];
            if ((3 * a) > n)
            {
                Console.WriteLine("-1");
                return;
            }
            int[] A = new int[3];
            int[] B = new int[3];
            A[0] = a;
            B[0] = a-2;
            int p = 1;
            while (p == 1)
            {
               
                int z = n - A[0] - B[0];
                if (z % 4 == 0)
                {
                    p = 0;
                }
                else
                {
                    B[0]--;
                }
            }
            int c = n - A[0] - B[0];
            
            A[1] = (c/ 4) + 1;
            A[2] = (c / 4) + 1;
            B[1] = (c / 4) - 1;
            B[2] = (c / 4) - 1;
            Console.WriteLine(A[0] + " " + B[0]);
            Console.WriteLine(A[1] + " " + B[1]);
            Console.WriteLine(A[2] + " " + B[2]);


        }
    }
}