#include <bits/stdc++.h>
using namespace std;
long long ans, m, x;
long long n;
char c;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        if (j != n - 1)
          cout << m << " ";
        else
          cout << m;
      } else {
        if (j != n - 1)
          cout << 0 << " ";
        else
          cout << 0;
      }
    }
    if (i != n - 1) cout << endl;
  }
}
