#include <bits/stdc++.h>
int main() {
  int n, k, a, b, i, j;
  scanf("%d %d", &n, &k);
  a = k / n;
  b = a + k % n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) printf("%d ", i == j ? b : a);
    puts("");
  }
  return 0;
}
