#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e4 + 10;
const int M = (int)1e9 + 7;
int n, k;
int mina, maxa;
void track() {
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (n); j++) {
      if (i == j)
        cout << k;
      else
        cout << 0;
      if (j != n) cout << " ";
    }
    cout << endl;
  }
  cout << endl;
}
int main() {
  cin >> n >> k;
  track();
  return 0;
}
