#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  for (int r = 0; r < n; r++) {
    for (int c = 0; c < n; c++) {
      if (c > 0) cout << ' ';
      if (r == c)
        cout << k;
      else
        cout << 0;
    }
    cout << endl;
  }
  return 0;
}
