#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, d, m, ma = 0, ind = 0, cou = 0, j, sum = 0, k, maxx = INT_MIN,
      flag = 0;
  int n;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i == j)
        cout << k << " ";
      else
        cout << "0 ";
    }
    cout << endl;
  }
}
