#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int main() {
  int i, j, n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (i = 1; i <= n; i++) a[i][i] = k;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= n; j++) {
        if (j == 1)
          printf("%d", a[i][j]);
        else
          printf(" %d", a[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
