#include <iostream>

using namespace std;

int main()
{
    int n, m, paran = 1;
    int rez11, rez12, rez13, rez21, rez22, rez23;

    cin >> n;
    cin >> m;

    if((n - 2*m)%2)
        paran = 0;

    if(!paran)
    {
        rez11 = m;
        rez21 = 1;
    }
    else
    {
        rez11 = m;
        rez21 = 0;
    }

    rez12 = m;
    rez22 = 0;

    if(!paran)
        --n;
    rez13 = ((n - 2 * m)/2) + 1;
    rez23 = ((n - 2 * m)/2) - 1;

    cout << rez11 << " " << rez21 << endl;
    cout << rez12 << " " << rez22 << endl;
    cout << rez13 << " " << rez23 << endl;

    return 0;
}