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