#include <bits/stdc++.h>
using namespace std;
long long pow_mod(long long x, long long y) {
  long long r = 1;
  for (; y; y >>= 1, x = (long long)x * x % 1000000007)
    if (y & 1) r = (long long)r * x % 1000000007;
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) {
        cout << k << " ";
      } else {
        cout << 0 << " ";
      }
    }
    cout << "\n";
  }
}
