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

namespace ConsoleApp12
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            int A = Convert.ToInt32(Console.ReadLine());
            int nula = 0;
            if (N / A < 3)
            {
                int minusjedan = -1;
                Console.WriteLine(minusjedan.ToString());
            }
            else
            {
                if (N / A < 10)
                {
                    int p = N / A;
                    if (p == 3)
                    {
                        int ukpoena1 = p * A;
                        int ukpoena2 = N - ukpoena1;

                        if (ukpoena2 == (A - 1))
                        {
                            int a = A - 2;
                            int b = 1;
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(A.ToString() + " " + b.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        else
                        {
                            Console.WriteLine(A.ToString() + " " + ukpoena2.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                    }
                    if (p == 4)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = p * A;
                        int nekibroj2 = N - nekibroj1;
                        if (nekibroj2 == (A - 1))
                        {
                            int a = A - 2;
                            int b = 1;
                            Console.WriteLine(A.ToString() + " " + b.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        else
                        {
                            ukpoena1 = 3 * A + nekibroj2;
                            ukpoena2 = A;
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(nekibroj2.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                    }
                    if (p == 5)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = p * A;
                        int nekibroj2 = N - nekibroj1;

                        if (nekibroj2 == (A - 1))
                        {
                            int a = A - 2;
                            int b = 1;
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(b.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        else
                        {
                            ukpoena1 = 3 * A + nekibroj2;
                            ukpoena2 = 2 * A;
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(nekibroj2.ToString() + " " + A.ToString());
                            Console.WriteLine(nula.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        
                    }
                    if (p == 6)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = 5 * A;
                        int nekibroj2 = N - nekibroj1;
                        ukpoena1 = 3 * A + nekibroj2;
                        ukpoena2 = 2 * A;
                        int a = A - 2;
                        int b = nekibroj2 - a;

                        if (b > (A - 2))
                        {
                            int c = A - 2;
                            int d = b - c;
                            Console.WriteLine(A.ToString() + " " + d.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(c.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        else
                        {
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(b.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        
                    }
                    if (p == 7)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = 5 * A;
                        int nekibroj2 = N - nekibroj1;
                        ukpoena1 = 3 * A + 2 * (A - 2);
                        ukpoena2 = 2 * A + nekibroj2 - 2 * (A - 2);
                        int a = A - 2;
                        int b = nekibroj2 - 2 * a;

                        if (b > (A - 2))
                        {
                            int c = b - a;
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(A.ToString() + " " + c.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        else
                        {
                            Console.WriteLine(A.ToString() + " " + b.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }


                        
                    }
                    if (p == 8)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = 5 * A;
                        int nekibroj2 = N - nekibroj1;
                        ukpoena1 = 3 * A + 2 * (A - 2);
                        ukpoena2 = 2 * A + nekibroj2 - 2 * (A - 2);
                        int a = A - 2;
                        int b = nekibroj2 - 3 * a;

                        if (b > (A - 2))
                        {
                            int c = b - a;
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + c.ToString());
                        }
                        else
                        {
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(A.ToString() + " " + b.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + nula.ToString());
                        }
                        
                    }
                    if (p == 9)
                    {
                        int ukpoena1;
                        int ukpoena2;
                        int nekibroj1 = 5 * A;
                        int nekibroj2 = N - nekibroj1;
                        ukpoena1 = 3 * A + 2 * (A - 2);
                        ukpoena2 = 2 * A + nekibroj2 - 2 * (A - 2);
                        int a = A - 2;
                        int b = nekibroj2 - 4 * a;
                        if (b > (A - 2))
                        {
                            int k = (N - 10 * A + 10) / 2;
                            ukpoena1 = 5 * A + k - 4;
                            ukpoena2 = 5 * A + k - 6;
                            int a1 = A - 2;
                            int b1 = A + k;
                            int c = A + k - 2;

                            if (N % 2==1)
                            {
                                int minusjedan = -1;
                                Console.WriteLine(minusjedan.ToString());
                            }
                            else
                            {
                                Console.WriteLine(A.ToString() + " " + a1.ToString());
                                Console.WriteLine(A.ToString() + " " + a1.ToString());
                                Console.WriteLine(a1.ToString() + " " + A.ToString());
                                Console.WriteLine(a1.ToString() + " " + A.ToString());
                                Console.WriteLine(b1.ToString() + " " + c.ToString());
                            }
                            
                        }
                        else
                        {
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(A.ToString() + " " + a.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(a.ToString() + " " + A.ToString());
                            Console.WriteLine(A.ToString() + " " + b.ToString());
                        }
                    }
                }
                else
                {
                    if (N % 2 == 1)
                    {
                        int minusjedan = -1;
                        Console.WriteLine(minusjedan.ToString());
                    }
                    else
                    {
                        int k = (N - 10 * A + 10) / 2;
                        int ukpoena1 = 5 * A + k - 4;
                        int ukpoena2 = 5 * A + k - 6;
                        int a = A - 2;
                        int b = A + k;
                        int c = A + k - 2;
                        Console.WriteLine(A.ToString() + " " + a.ToString());
                        Console.WriteLine(A.ToString() + " " + a.ToString());
                        Console.WriteLine(a.ToString() + " " + A.ToString());
                        Console.WriteLine(a.ToString() + " " + A.ToString());
                        Console.WriteLine(b.ToString() + " " + c.ToString());
                    }
                    
                }
            }

        }
    }
}