#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    pair<int,int> c[5];
    if(a<3*b)cout << "-1";
    else if(a<4*b)//TRI SETA
    {
        //PRVO RASPOREDJIVANJE
        c[0].first=b;
        c[0].second=0;
        c[1].first=0;
        c[1].second=b;
        c[2].first=b;
        c[2].second=0;
        a=a-3*b;
        //DRUGO RASPOREDJIVANJE
        for(int i=0;i<3;i++)
        {
            if(a>=b-2)
            {
                if(i%2==0) c[i].second+=b-2;
                else c[i].first+=b-2;
                a=a-b+2;
            }
            else
            {
                if(i%2==0) c[i].second+=a;
                else c[i].first+=a;
                a=0;
            }
        }
        //TRECE RASPOREDJIVANJE
        if(a%2==0)
        {
            c[0].first+=a/2;
            c[0].second+=a/2;
            a=0;
        }
        else if(a>0)
        {
            c[0].first+=(a+1)/2;
            c[0].second+=(a+1)/2;
            c[1].first--;
        }
        //ISPIS
        for(int i=0;i<3;i++)
        {
            cout << c[i].first << " " << c[i].second << endl;
        }
    }
    else if(a<5*b)//CETIRI SETA
    {
        //PRVO RASPOREDJIVANJE
        c[0].first=b;
        c[0].second=0;
        c[1].first=0;
        c[1].second=b;
        c[2].first=b;
        c[2].second=0;
        c[3].first=0;
        c[3].second=b;
        a=a-4*b;
        //DRUGO RASPOREDJIVANJE
        for(int i=0;i<4;i++)
        {
            if(a>=b-2)
            {
                if(i%2==0) c[i].second+=b-2;
                else c[i].first+=b-2;
                a=a-b+2;
            }
            else
            {
                if(i%2==0) c[i].second+=a;
                else c[i].first+=a;
                a=0;
            }
        }
        //TRECE RASPOREDJIVANJE
        if(a%2==0)
        {
            c[0].first+=a/2;
            c[0].second+=a/2;
            a=0;
        }
        else if(a>0)
        {
            c[0].first+=(a+1)/2;
            c[0].second+=(a+1)/2;
            c[1].first--;
        }
        //ISPIS
        for(int i=0;i<4;i++)
        {
            cout << c[i].first << " " << c[i].second << endl;
        }
    }
    else//PET SETOVA
    {
        //PRVO RASPOREDJIVANJE
        c[0].first=b;
        c[0].second=0;
        c[1].first=0;
        c[1].second=b;
        c[2].first=b;
        c[2].second=0;
        c[3].first=0;
        c[3].second=b;
        c[4].first=b;
        c[4].second=0;
        a=a-5*b;
        //DRUGO RASPOREDJIVANJE
        for(int i=0;i<5;i++)
        {
            if(a>=b-2)
            {
                if(i%2==0) c[i].second+=b-2;
                else c[i].first+=b-2;
                a=a-b+2;
            }
            else
            {
                if(i%2==0) c[i].second+=a;
                else c[i].first+=a;
                a=0;
            }
        }
        //TRECE RASPOREDJIVANJE
        if(a%2==0)
        {
            c[0].first+=a/2;
            c[0].second+=a/2;
            a=0;
        }
        else if(a>0)
        {
            c[0].first+=(a+1)/2;
            c[0].second+=(a+1)/2;
            c[1].first--;
        }
        //ISPIS
        for(int i=0;i<5;i++)
        {
            cout << c[i].first << " " << c[i].second << endl;
        }
    }




}