#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, arr[100000], u, c = 0, h;
  cin >> x >> y;
  if (x == 1) {
    cout << y << endl;
  } else if (x > 1) {
    u = x * x;
    h = x;
    while (h > 2) {
      ++c;
      --h;
    }
    arr[1] = 0;
    arr[u] = 0;
    for (int i = 2; i < u; i++) {
      if (i != x) {
        arr[i] = 0;
      }
      if (i >= x) {
        arr[i] = y;
        for (int k = 0; k < c; k++) {
          ++i;
          arr[i] = 0;
        }
      }
    }
    for (int i = 1; i < u + 1; i++) {
      cout << arr[i] << " ";
      if (i % x == 0) {
        cout << endl;
      }
    }
  }
  return 0;
}
