#include <iostream>
using namespace std;
void ispis(int a,int b,int c,int d,int e,int f)
{
    cout<<a<<" "<<b<<endl<<c<<" "<<d<<endl<<e<<" "<<f;
}
int main()
{
    long long int a,n,pa,pb,da,db,ta,tb,i=1,k;
    cin>>n>>a;
    k=n;
    if(3*a>n){
        cout<<-1;
        i=0;
    }
    else
    {
        pa=a;
        da=a;
        ta=a;
        pb=0;
        db=0;
        tb=0;
        n-=3*a;
        if(n>pa-2)
        {
            n-=a-2;
            pb=a-2;
        }
         else
        {
            pb=n;
            n=0;
        }
        if(n>0&&n%2==0)
         {
             pa+=n/2;
             pb+=n/2;
             n=0;
         }
         if(n>0&&n%2==1)
         {
             db=1;
             if(da==2)
                db=3;
             n--;
             pa+=n/2;
             pb+=n/2;
             n=0;

         }
    }
    if(n!=0&&i==1||pa+pb+da+db+ta+tb!=k)
        cout<<-1;

    if(i==1&&n==0&&pa+pb+da+db+ta+tb==k)
        ispis(pa,pb,da,db,ta,tb);



    }