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)
{
    string[] s=new string[2];
    s=Console.ReadLine().Split(' ');
    int n=int.Parse(str[0]);
    int a=int.Parse(str[1]);
    if (n>6*a-6)
        {
            if ((n-6*a+6)%2==0)
            {
                int ps1=a;
                int ps2=a-2;
                int ds1=a;
                int ds2=a-2;
                int ts1=a+(n-6*a+6)/2;
                int ts2=a-2+(n-6*a+6)/2;
                Console.WriteLine(ps1+" " +ps2);
                Console.WriteLine(ds1+" " +ds2);
                Console.WriteLine(ts1+" " +ts2);
            }
            else
            {
                int ps1=a;
                int ps2=a-2;
                int ds1=a;
                int ds2=a-3;
                int ts1=a+(n-6*a+7)/2;
                int ts2=a-2+(n-6*a+7)/2;
                Console.WriteLine(ps1+" " +ps2);
                Console.WriteLine(ds1+" " +ds2);
                Console.WriteLine(ts1+" " +ts2);
            }
        }
        else if (n<=6*a-6 && p>=3*a)
        {
            int ps1=a;
            int ds1=a;
            int ts1=a;
            int ps2;
            int ds2;
            int ts2;
            if (n>=4*a-2) ps2=a-2;
            else ps2=n-3*a;
            if (n-3*a-ps2>=a-2) ds4=a-2;
            else ds2=n-3*a-ps2;
            ts2=n-3*a-ps2-ds2
            Console.WriteLine(ps1+" " +ps2);
            Console.WriteLine(ds1+" " +ds2);
            Console.WriteLine(ts1+" " +ts2);
        }
        else Console.WriteLine(-1);
}
}
}