#include <bits/stdc++.h>
using namespace std;
void init_code() {}
signed main() {
  init_code();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    long long arr[n];
    long long i;
    for (i = 0; i < n - 1; i++) arr[i] = 0;
    arr[i] = k;
    for (long long i = 0; i < n; i++) {
      for (long long j = i; j < n; j++) cout << arr[j] << " ";
      for (long long m = 0; m < i; m++) cout << arr[m] << " ";
      cout << "\n";
    }
  }
}
