#include <bits/stdc++.h>
using namespace std;
int BS(int ar[], int val, int siz) {
  int lo = 0, hi = siz - 1, mid;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    if (ar[mid] == val) {
      return mid;
    } else if (ar[mid] > val) {
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  return -1;
}
int main() {
  int a, b, c = 0, d = 0;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      if (i == c && j == d) {
        cout << b << " ";
        c++;
        d++;
      } else
        cout << 0 << " ";
    }
    cout << endl;
  }
  return 0;
}
