#include <bits/stdc++.h>
using namespace std;
const int MAXn = 100;
int a[MAXn + 2][MAXn + 2];
int main() {
  int n, k;
  cin >> n >> k;
  int rem = k % n;
  k -= rem;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) a[i][j] = k / n;
  for (int i = 0; i < n; i++) {
    int cnt = i;
    for (int j = 0; j < rem; j++) {
      a[i][cnt]++;
      cnt = (cnt + 1) % n;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cout << a[i][j] << " ";
    cout << endl;
  }
  return 0;
}
