#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, j, l, m;
  cin >> n >> k;
  int a[n][n];
  l = 0;
  m = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i == l && j == m) {
        cout << k << " ";
        l++;
        m++;
      } else
        cout << 0 << " ";
    }
    cout << endl;
  }
}
