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