#include <iostream>
#include <assert.h>

using namespace std;

int main()
{
    int N, A;
    
    cout << "Unesi ukupan broj poena na utakmici: ";
    cin >> N;
    assert (N>=2);
    assert(N<=1000000000);
    cout << "Unesi minimalan broj poena za pobedu u setu: ";
    cin >> A;
    assert (A>=2);
    assert(A<=1000000000);
    if (N < 3 * A)
    {
        cout << -1 << endl;
    }
    else
    {
       N=N-A; //1.
       cout << A << " " << 0 << endl;
       
        if (N + 2 <= 3 * A)
        {
            N = N - A; //2.
            N = N - A;
            cout << A << " " << N << endl;
            cout << A; //3.
            cout << " " << 0 << endl;
        }
        else 
        {
            if (N % 2 == 1)
            {
                N = N - A; //2.
                cout << A << " "<< 1 << endl;
            }
            else
            {
            	N = N - A; //2.
                cout << A;
                cout << " "<< 0 << endl;
            }
            N = N / 2; //3.
            cout << N + 1;
            cout << " ";
            cout << N - 1 << endl;
        }
    }
    return 0;
}