#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  Int x=3*n/2;
  if(k+x>2*n) drop(-1);

  for(Int i=0,j=0;i<n;i++){
    if(i+x<2*n){
      cout<<k+i<<" "<<k+x+i<<" "<<k+n+n+i*2<<"\n";
    }else{
      cout<<k+i<<" "<<k+n+j<<" "<<k+n+n+j*2+1<<"\n";
      j++;
    }
  }
  return 0;
}
