#include <bits/stdc++.h>

using namespace std;

int Uk, Mbr, a, b, c, d, e, f, g, h, i, j;

int main () {
    cin >> Uk >> Mbr;
    if (((a>=Mbr and a>b and a-b>=2) or (b>=Mbr and b>a and b-a>=2)) and ((c>=Mbr and c>d and c-d>=2) or (d>=Mbr and d>c and d-c>=2)) and ((e>=Mbr and e>f and e-f>=2)
    or (f>=Mbr and f>e and f-e>=2)) and a+b+c+d+e+f==Uk) {
       cout << a << " " << b << endl;
       cout << c << " " << d << endl;
       cout << e << " " << f << endl;
    }
    else 
    {
       cout << "-1";
    }
    
    if (((a>=Mbr and a>b and a-b>=2) or (b>=Mbr and b>a and b-a>=2)) and ((c>=Mbr and c>d and c-d>=2) or (d>=Mbr and d>c and d-c>=2)) and ((e>=Mbr and e>f and e-f>=2)
    or (f>=Mbr and f>e and f-e>=2)) and ((g>=Mbr and g>h and g-h>=2) or (h>=Mbr and h>g and h-g>=2)) and ((i>=Mbr and i>j and i-j>=2) or (j>=Mbr and j>i and j-i>=2))
    and a+b+c+d+e+f+g+h+i+j==Uk) {
        cout << a << " " << b << endl;
        cout << c << " " << d << endl;
        cout << e << " " << f << endl;
        cout << g << " " << h << endl;
        cout << i << " " << j << endl;
    }
    else
    {
       cout << "-1";
    }
        
        
    
    
    
    
    
    
    
    return 0;
}