#include using namespace std; using ll = long long; constexpr int inf32 = numeric_limits::max() / 2; constexpr ll inf64 = numeric_limits::max() / 2; template bool chmin(T1 &a, T2 b) { return a > b ? a = b, true : false; } template bool chmax(T1 &a, T2 b) { return a < b ? a = b, true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, K; cin >> N >> K; if (K == 0) { cout << -1 << '\n'; return 0; } for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cout << (i * N + j + N * N - K) % (N * N) + 1 << " \n"[j + 1 == N]; } } }