#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int mat[128][128];
  memset(mat, 0, sizeof mat);
  cin >> n >> k;
  int num1 = k / 2;
  int num2 = k - num1;
  for (int i = 0; i < n - 1; i += 2) {
    mat[i][i] = num1;
    mat[i + 1][i + 1] = num1;
    mat[i][i + 1] = num2;
    mat[i + 1][i] = num2;
  }
  if (n & 1) mat[n - 1][n - 1] = k;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j == 0)
        cout << mat[i][j];
      else
        cout << " " << mat[i][j];
    }
    cout << endl;
  }
  cout << endl;
  return 0;
}
