#include <iostream>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

    int n,i,j,k,x,y,t,a,b,c,d,e,f;

    cin>>n>>k;

    if(n<3*k || (n==7 && k==2)) cout<<"-1";   //zli slucaj 7-2
    else
    {
        a=k; b=0;
        c=k; d=0;
        e=k; f=0;

        if(n>6*k-6 && n%2==1)
        {
            d=1; n--; n-=2*k;
            e=n/2+1;  f=n/2-1;
        }
        else if(n>6*k-6 && n%2==0)
        {
            n-=2*k;
            e=n/2+1;  f=n/2-1;
        }
        else
        {
            n-=3*k;
            b=min(k-2,n);  n-=b;
            d=min(k-2,n);  n-=d;
            f=min(k-2,n);  n-=f;
        }

        cout<<a<<" "<<b<<endl;
        cout<<c<<" "<<d<<endl;
        cout<<e<<" "<<f<<endl;
    }

    return 0;
}