#include <bits//stdc++.h>

using namespace std;

int mecevi(int i, int a, int sred, int n)
{
    int d=2, mec1, mec2, sred1, j=0;
    int i1=i;
    int b[20];
    sred1=n%sred+sred;
    while(i>0)
    {
        if(i==i1)
        {
            mec1=a+d;
            mec2=sred1-mec1;
        }
        else
        {
            mec1=a+d;
            mec2=sred-mec1;
        }
        if(abs(mec1-mec2)>=2)
        {
            b[j]=mec1;
            b[j+1]=mec2;
            j=j+2;
            i--;
        }
        d++;
    }
    bool br=true;
    if(i1==3)
    {
        for(int k=0; k<6; k++)
        {
            cout<<b[k]<<" "<<b[k+1]<<endl;
            k++;
        }
    }
    else if(i1==4)
    {
        for(int k=0; k<8; k++)
        {
            if(br==true)
            {
                if(b[k]>=b[k+1])
                    cout<<b[k]<<" "<<b[k+1]<<endl;
                else
                    cout<<b[k+1]<<" "<<b[k]<<endl;
                br++;
                if(br==2)
                    br=false;
            }
            else
            {
                if(b[k]<=b[k+1])
                    cout<<b[k]<<" "<<b[k+1]<<endl;
                else
                    cout<<b[k+1]<<" "<<b[k]<<endl;
                br=true;
            }
            k++;
        }
    }
    else
    {
        for(int k=0; k<10; k++)
        {
            if(br==true)
            {
                if(b[k]>=b[k+1])
                    cout<<b[k]<<" "<<b[k+1]<<endl;
                else
                    cout<<b[k+1]<<" "<<b[k]<<endl;
                br=false;
            }
            else
            {
                if(b[k]<=b[k+1])
                    cout<<b[k]<<" "<<b[k+1]<<endl;
                else
                    cout<<b[k+1]<<" "<<b[k]<<endl;
                br=true;
            }
            k++;
        }
    }
}

int main()
{
    int sum, a, sum3, sum4, sum5, raz3, raz4, raz5;
    cin>>sum>>a;
    if(sum>=a*3)
    {
        sum3=sum/3;
        sum4=sum/4;
        sum5=sum/5;
        raz3=sum3-a;
        int raz33=sum3-raz3;
        raz4=sum4-a;
        int raz44=sum4-raz4;
        raz5=sum5-a;
        int raz55=sum5-raz5;
        if(raz33<=raz44 && raz33<=raz55)
        {
            mecevi(3,a,sum3,sum);
        }
        else if(raz44<=raz55 && raz44<=raz33)
        {
            mecevi(4,a,sum4,sum);
        }
        else
        {
            mecevi(5,a,sum5,sum);
        }
    }
    else
        cout<<"-1"<<endl;


}