#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int i, j, d = 0, w;
  vector<int> a;
  a.push_back(0);
  for (i = 1; i < n; i++) a.push_back(1);
  a.push_back(k - (n - 1));
  for (i = 1; i <= n; i++) {
    if (i == 1)
      for (j = 1; j <= n; j++) cout << a[j] << " ";
    else {
      d = n - i + 2;
      w = d;
      while (d <= n) cout << a[d++] << " ";
      for (j = 1; j < w; j++) cout << a[j] << " ";
    }
    cout << endl;
  }
  return 0;
}
