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