#include <bits/stdc++.h>
using namespace std;

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

    int n, a;
    cin >> n >> a;

    int x[3], y[3];

    // Condition for winning

    for (int i = 0; i < 3; i++) {
        x[i] = a;
        y[i] = 0;

        n -= a;

        if (n < 0) {
            cout << "-1";
            return 0;
        }
    }

    // Spread the rest (or rest - 1) to last result

    x[2] -= a;
    n += a;

    int half = n / 2;
    x[2] += half + 1;
    y[2] += half - 1;
    n -= 2 * half;

    // Odd number point

    if (n % 2 != 0) {
        y[0]++;
        n--;

        if (x[0] - y[0] < 2) {
            cout << "-1";
            return 0;
        }
    }

    // Output

    for (int i = 0; i < 3; i++) {
        cout << x[i] << ' ' << y[i] << '\n';
    }
}