#include #include #define chmin(x,y) (x) = min((x),(y)) #define chmax(x,y) (x) = max((x),(y)) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define vec vector #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define pb push_back #define eb emplace_back using namespace std; using namespace atcoder; using ll = long long; using ld = long double; const ll mod = 998244353; using mint = modint998244353; const vector dx = {1,0,-1,0}, dy = {0,1,0,-1}; // using Graph = vector>>; using Graph = vector>; int main(){ // input int N,K; cin >> N >> K; if(K == 0){ cout << "-1\n"; return 0; } vector> ans(N,vector(N,-1)); int large = N * N - K + 1, small = 1; rep(i,K){ ans[i%N][i/N] = large; large++; } assert(large == N*N+1); rep(i,N) rep(j,N){ if(ans[i][j] != -1) continue; ans[i][j] = small; small++; } assert(small = N*N-K+1); // output rep(i,N){ rep(j,N){ if(j) cout << " "; cout << ans[i][j]; } cout << "\n"; } return 0; }