#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, K;
    cin >> N >> K;
    long long X, Y;
    Y = ((long long)(K+3*N-1)+(K+2*N))*N/2; 
    X = ((long long)K+(K+3*N-1))*(3*N)/2 - Y;
    if (X > Y) {
        puts("-1");
        return 0;
    }
    // 2K-1 <= N
    int l = K, r = K+2*N-1;
    int k = K+2*N;
    bool f = 0;
    while (1) {
        if (k > K+3*N-1) {
            if (f) {
                return 0;
            }
            f = 1;
            k = K+2*N+1;
            continue;
        }
        int i = l;
        int j = k-i;
        if (j < r) {
            int nr = j-1;
            for (; j <= r && k <= (K+3*N-1); i++, j++, k += 2) {
                printf("%d %d %d\n", i, j, k);
            }
            l = i, r = nr;
        }
        else {
            j = r;
            for (; i < j && k <= (K+3*N-1); i++, j--, k += 2) {
                printf("%d %d %d\n", i, j, k);
            }
            l = i, r = j;
        }
    }
}