#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N, K;

    void gu() {
        vector<pair<Int, Int>> tapi(N);
//        for (int i = 0; i < N; ++i) {
//            tapi[i].first = i + K;
//            tapi[i].second = 2 * (N + K) - 1 - tapi[i].first;
//        }
        Int neri = K + 2 * N - 2;
        for (int i = 0; i < N / 2; ++i) {
            tapi[i].first = K + i;
            tapi[i].second = neri;
            neri -= 2;
        }

        neri = K + 2 * N - 1;
        for (int i = N / 2; i < N; ++i) {
            tapi[i].first = K + i;
            tapi[i].second = neri;
            neri -= 2;
        }
        sort(all(tapi), [](auto a, auto b) {
            return (a.first + a.second) < (b.first + b.second);
        });

        for (int i = 0; i < N; ++i) {
            cout << tapi[i].first << " " << tapi[i].second << " " << 2 * N + K + i << endl;
        }
    }

    void ki() {
        Int X = N / 2;
        Int Y = N - X;
        if (X % 2) swap(X, Y);
        vector<pair<Int, Int>> tapu(N);
        for (int i = 0; i < N; ++i) {
            tapu[i].first = K + i;
            tapu[i].second = (K + K + 2 * N - 1) - tapu[i].first;
        }
        Int ei = 0ll;
        Int usi = X - 1;
        while (ei < usi) {
            swap(tapu[ei].second, tapu[usi].second);
            ei++;
            usi--;
        }
        ei = X;
        usi = X + Y - 1;
        while (ei < usi) {
            swap(tapu[ei].second, tapu[usi].second);
            ei++;
            usi--;
        }

        sort(all(tapu), [](auto a, auto b) {
            return a.first + a.second < b.first + b.second;
        });

        for (int i = 0; i < N; ++i) {
            cout << tapu[i].first << " " << tapu[i].second << " " << K + 2 * N + i << endl;
        }
    }

    void solve() {
        cin >> N >> K;
        if (2ll * K > (N + 1)) {
            cout << -1 << endl;
            return;
        }
        if (N % 2) {
            ki();
        } else {
            gu();
        }


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 4216