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

typedef long long ll;

bool can_make_match(const int &x, const int &a) {
    if (x <= (2 * a  - 2)) return true;
    if (x <= 2 * a) return false;
    if (x % 2 == 1) return false;
    return true;
}

int gen(int a, int n, int r[]) {
    int maxi = 2 * a - 2;
    r[0] = maxi;
    if ((n - 2 * maxi) % 2 == 0) {
        r[1] = maxi;
        r[2] = n - 2 * maxi;
    }
    else {
        r[1] = maxi - 1;
        r[2] = n - 2 * maxi + 1;
    }
    if (can_make_match(r[0], a) && can_make_match(r[1], a) && can_make_match(r[2], a))
        return 3;        
    r[0] = maxi;
    r[1] = maxi;
    if ((n - 3 * maxi) % 2 == 0) {
        r[2] = maxi;
        r[3] = n - 3 * maxi;
    }    
    else {
        r[2] = maxi - 1;
        r[3] = n - 3 * maxi + 1;
    }
    if (can_make_match(r[0], a) && can_make_match(r[1], a) && can_make_match(r[2], a) && can_make_match(r[3], a))
        return 4;
    r[0] = maxi;
    r[1] = maxi;
    r[2] = maxi;
    if ((n - 4 * maxi) % 2 == 0) {
        r[3] = maxi;
        r[4] = n - 4 * maxi;
    }    
    else {
        r[3] = maxi - 1;
        r[4] = n - 4 * maxi + 1;
    }
    if (can_make_match(r[0], a) && can_make_match(r[1], a) && can_make_match(r[2], a) && can_make_match(r[3], a) && can_make_match(r[4], a))
        return 5;
    else return -1;
}

bool resi(int a, int n) {
    int r[5] = {0};
    int sol = gen(a, n, r);
    bool check = 1;
    for (int i = 0 ; i < sol ; i++) {
        if (r[i] < 0) {
            return 0;
        }
    }

    //cout << sol << "\n";
    for (int i = 0 ; i < sol ; i++) {
        if (r[i] < 2 * a) {
            cout << a << " " << r[i] - a << "\n";
        }
        else {
            int tmp = (r[i] - 2) / 2;
            cout << tmp << " " << tmp + 2 << "\n";
        }
    }
    return 1;
}

int main () {
    ios::sync_with_stdio(false);
    int n, a;

    cin >> n >> a;

    if(!resi(a, n)) cout << "-1\n";

    return 0;
}