#include #include using namespace std; using namespace atcoder; // 型エイリアス using ll = long long; using lll = __int128_t; using mint = modint1000000007; using pll = pair; using tll = tuple; using tll4 = tuple; using vll = vector; using vvll = vector; using vvvll = vector; using vdl = vector; using vvdl = vector; using vvvdl = vector; using vch = vector; using vvch = vector; using vvvch = vector; using vst = vector; using vvst = vector; using vvvst = vector; using vbo = vector; using vvbo = vector; using vvvbo = vector; using vmi = vector; using vvmi = vector; using vvvmi = vector; using vpll = vector; using vvpll = vector; using vvvpll = vector; using vtll = vector; using vvtll = vector; using vvvtll = vector; using vtll4 = vector; using vvtll4 = vector; using vvvtll4 = vector; // rep系 #define REP1(n) for(ll _ = 0 ; _ < (n); _++) #define REP2(i, n) for(ll i = 0; i < (n); i++) #define REP3(i, m, n) for(ll i = (m); i < (n); i++) #define REP4(i, m, n, d) for(ll i = (m); i < (n); i += (d)) #define RREP1(n) for(ll _ = (n) - 1 ; _ >= 0; _--) #define RREP2(i, n) for(ll i = (n) - 1; i >= 0; i--) #define RREP3(i, m, n) for(ll i = (m) - 1; i >= (n); i--) #define RREP4(i, m, n, d) for(ll i = (m) - 1; i >= (n); i -= (d)) #define OVERLOAD4(a, b, c, d, e, ...) e #define rep(...) OVERLOAD4(__VA_ARGS__, REP4, REP3, REP2, REP1)(__VA_ARGS__) #define rrep(...) OVERLOAD4(__VA_ARGS__, RREP4, RREP3, RREP2, RREP1)(__VA_ARGS__) // 入力 template void CIN(T& x) { cin >> x; } template void CIN(T& x, Ts&... xs) { cin >> x; CIN(xs...); } #define LL(...) ll __VA_ARGS__; CIN(__VA_ARGS__) #define DBL(...) double __VA_ARGS__; CIN(__VA_ARGS__) #define CHAR(...) char __VA_ARGS__; CIN(__VA_ARGS__) #define STR(...) string __VA_ARGS__; CIN(__VA_ARGS__) #define VEC(type, name, N) vector name(N); for(auto& x: name) cin >> x #define VEC2(type, name, N, M) vector> name(N, vector(M)); for(auto& v : name) for(auto& x : v) cin >> x // 出力 const pair YESNO_STRINGS = {"Yes", "No"}; template void PR(const T& a, const Ts&... b) { cout << a; ((cout << ' ' << b), ...); cout << '\n'; } template void PRS(const Ts&... a) { ((cout << a << ' '), ...); } template void PRC(const Container& c) { bool first = true; for (const auto& x : c) {if (!first) {cout << ' ';} cout << x; first = false; } cout << '\n'; } #define YES PR(YESNO_STRINGS.first) #define NO PR(YESNO_STRINGS.second) bool YN(bool f) { if (f) { YES; return true; } NO; return false; } // 整数系マクロ template T MOD(T n, U m) { return (n % m + m) % m; } template bool ODD(T n) { return MOD(n, 2) == 1; } template bool EVEN(T n) { return MOD(n, 2) == 0; } template T CEIL(T n, U d) { return (n + d - 1) / d; } template T POW(T x, T n) { assert(n >= 0); T ret = 1; while(n > 0) { if (n % 2 == 1) { ret = ret * x; } x *= x; n /= 2; } return ret; } template T SQRT(T n) { T x = (T)sqrt(n); while((x + 1) * (x + 1) <= n) { x++; } while(x * x > n) { x--; } return x; } template bool BIT(T n, U i) { return (n >> i) & 1; } template ll POPCNT(T n) { return popcount((unsigned long long)n); } template ll DIGSZ(T n) { return to_string(n).size(); } // コンテナ系マクロ #define ALL(v) (v).begin(),(v).end() #define RALL(v) (v).rbegin(),(v).rend() template ll SZ(T& v) { return v.size(); } template void ADD(T& v, const U& x) { if constexpr (ranges::range) { for (auto& e : v) { ADD(e, x); } } else { v += x; } } template void INC(Container& C) { ADD(C, 1); } template void DEC(Container& C) { ADD(C, -1); } template void UNIQUE(T& A) { sort(A.begin(), A.end()); A.erase(unique(A.begin(), A.end()), A.end()); } template auto SUM(const T& v) { if constexpr (ranges::range) { decltype(SUM(*begin(v))) ret = 0; for (const auto& e : v) { ret += SUM(e); } return ret; } else { return v; } } template ll MAXID(const Container& C) { return distance(C.begin(), max_element(C.begin(), C.end())); } template ll MINID(const Container& C) { return distance(C.begin(), min_element(C.begin(), C.end())); } template ll FINDID(const Container& C, T x) { return distance(C.begin(), find(C.begin(), C.end(), x)); } template ll LBID(const Container& C, T x) { return distance(C.begin(), lower_bound(C.begin(), C.end(), x)); } template ll UBID(const Container& C, T x) { return distance(C.begin(), upper_bound(C.begin(), C.end(), x)); } template auto RLE(const Container& C) { vector> ret; for (const auto& x : C) { if (ret.empty() || x != ret.back().first) { ret.emplace_back(x, 1); } else { ret.back().second++; } } return ret; } template vector CUM(const vector& V) { vector ret(V.size()+1, 0); for (ll i = 0; i < (ll)V.size(); i++) { ret[i+1] = ret[i] + V[i]; } return ret; } // 幾何系マクロ template bool INGRID(T x, T y, T H, T W) { return x >= 0 && x < H && y >= 0 && y < W; } template T EDIST(T x1, T y1, T x2, T y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } template T MDIST(T x1, T y1, T x2, T y2) { return abs(x1 - x2) + abs(y1 - y2); } // その他便利マクロ template bool CHMIN(T& a, U b){ if(a>b){ a=b; return true; } return false; } template bool CHMAX(T& a, U b){ if(a void SORT(Ts&... xs) { vector v = {xs...}; sort(v.begin(), v.end()); int i = 0; ((xs = v[i++]), ...); } // 定数 const ll INF = 4'000'000'000'000'000'000LL; const ll DI[] = {1, -1, 0, 0}; const ll DJ[] = {0, 0, 1, -1}; const ll DI8[] = {-1, -1, -1, 0, 0, 1, 1, 1}; const ll DJ8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; const string DIR = "DURL"; const bool IS_MULTI_CASE = false; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); // --- ここからコードを書く --- LL(N, K); vvll ans(N, vll(N)); vll temp; ll k = 1; rep(i, N){ rep(j, N){ temp.push_back(k); k++; } } if(K <= 0){ PR(-1); }else{ ll cnt = 0, index = K-1, start = K-1; bool flag = false; while(1){ if(flag && index == start){ break; } cout << temp[index] << " "; index = (index + 1) % (N*N); flag = true; cnt++; if(cnt == N){ cnt = 0; cout << "\n"; } } } // --------------------------- return 0; }