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