using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
      {
		int p=int.Parse(Console.ReadLine());
		int a=int.Parse(Console.ReadLine());
        if (p>=3*a)
        {
            if (p>3*(2*a-2) )
		    {
			if ((p-3*(2*a-2)) %2==0)
			{
				int a3=a;
				int a4=a-2;
				int a5=a;
				int a6=a-2;
				int a1=a+(p-3*(2*a-2))/2;
				int a2=a-2+(p-3*(2*a-2))/2;
				Console.WriteLine(a1+" " +a2) ;
				Console.WriteLine(a3+" " +a4);
				Console.WriteLine(a5+" " +a6) ;
			}
			else
			{
				int a3=a;
				int a4=a-2;
				int a5=a;
				int a6=a-3;
				int a1=a+(p-2*(2*a-2)-2*a+3)/2;
				int a2=a-2+(p-2*(2*a-2)-2*a+3)/2;
                Console.WriteLine(a1+" " +a2);
				Console.WriteLine(a3+" " +a4);
				Console.WriteLine(a5+" " +a6);
			}
		}
		else if (p-3*a<=3*(a-2) && p-3*a>=0)
		{
			int a1=a;
			int a3=a;
			int a5=a;
			int a2, a4, a6;
			if ( p-3*a>=a-2) a2=a-2;
			else a2=p-3*a;
			if (p-3*a-a2>=a-2) a4=a-2;
			else a4=p-3*a-a2;
			a6=p-3*a-a2-a4;
			Console.WriteLine(a1+" " +a2);
			Console.WriteLine(a3+" " +a4);
			Console.WriteLine(a5+" " +a6);
		}
        }
		else Console.WriteLine(-1);
		}
    }
}