#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int a[110];
  scanf("%d %d", &n, &k);
  int i;
  for (i = 1; i < n; i++) a[i] = 1;
  a[i] = k - (n - 1);
  int l = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      l = l % n + 1;
      cout << a[l] << " ";
    }
    l++;
    cout << endl;
  }
  return 0;
}
