#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<vector<int> > a(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        a[i][j] = (k - (n - 1) * (k / n));
      else {
        a[i][j] = k / n;
      }
    }
  }
  for (auto i : a) {
    for (auto j : i) {
      cout << j << " ";
    }
    cout << "\n";
  }
  return 0;
}
