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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("unesite ukupan broj osvojenih poena");
            int n = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("unesite broj poena neophodnih za osvajanje seta");
            int a = Convert.ToInt32(Console.ReadLine());
            int t1 = 0, t2 = 0;
            if (n < a * 3)
            {
                Console.WriteLine("-1");
            }
            else if (n < a * 4)
            {
                t1 = a;
                if (n % (3 * a) == 1)
                {
                    t2 = 1;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine(t1 + " 0");
                }
                else if ((n - 3 * a) % 2 == 0)
                {
                    t2 = (n - 3 * a) / 2;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " 0");
                }
                else
                {
                    t2 = (n - 3 * a) / 2;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " " + (t2 + 1));
                    Console.WriteLine(t1 + " 0");
                }
            }
            else if (n < a * 5)
            {
                t1 = a;
                if (n % (4 * a) == 1)
                {
                    t2 = 1;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine(t1 + " 0");
                }
                else if ((n - 4 * a) % 2 == 0)
                {
                    t2 = (n - 4 * a) / 2;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                }
                else
                {
                    t2 = (n - 4 * a) / 2;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine(t1 + " " + (t2 + 1));
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                }
            }
            else if (n <= 10 * (a - 1))
            {
                t1 = a;
                if (n - 5 * a <= a - 2)
                {
                    t2 = n - 5 * a;
                    Console.WriteLine(t1 + " " + t2);
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                }
                else if (n - 5 * a <= 2 * a - 4)
                {
                    t2 = n - 5 * a;
                    Console.WriteLine(t1 + " " + (t2 - (a - 2)));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                }
                else if (n - 5 * a <= 3 * a - 6)
                {
                    t2 = n - 5 * a;
                    Console.WriteLine(t1 + " " + (t2 - 2 * (a - 2)));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " " + (a - 2));
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                }
                else if (n - 5 * a <= 4 * a - 8)
                {
                    t2 = n - 5 * a;
                    Console.WriteLine(t1 + " " + (t2 - 3 * (a - 2)));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " " + (a - 2));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " 0");
                }
                else
                {
                    t2 = n - 5 * a;
                    Console.WriteLine(t1 + " " + (t2 - 4 * (a - 2)));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " " + (a - 2));
                    Console.WriteLine((a - 2) + " " + t1);
                    Console.WriteLine(t1 + " " + (a - 2));
                }
            }
            else
            {
                t1 = a;
                if (n % 2 == 0)
                {
                    t2 = (n - (4 * a + 2)) / 2;
                    Console.WriteLine(t1 + " 2");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine((t2 + 1) + " " + (t2 - 1));
                }
                else
                {
                    t2 = (n - (4 * a + 1)) / 2;
                    Console.WriteLine(t1 + " 1");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine(t1 + " 0");
                    Console.WriteLine("0 " + t1);
                    Console.WriteLine((t2 + 1) + " " + (t2 - 1));
                }
            }
            Console.ReadLine();
        }
    }
}