#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, hold;
  vector<int> s;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    if (i == 0) {
      s.push_back(b);
    }
    s.push_back(0);
  }
  for (int i = 0; i < a; i++) {
    for (int i = 0; i < a; i++) {
      cout << s[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < a - 1; i++) {
      hold = s[i];
      s[i] = s[i + 1];
      s[i + 1] = hold;
    }
  }
}
