#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int i, j, k, n;
  cin >> n >> k;
  int ara[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) ara[i][j] = 0;
  }
  for (int i = 0; i < n; i++) {
    ara[i][i] = k;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cout << ara[i][j] << " ";
    cout << "\n";
  }
}
