#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j, c, temp;
  cin >> n >> k;
  int isi[n];
  for (i = 0; i < n; i++) {
    isi[i] = min(1000, k);
    k -= isi[i];
  }
  for (i = 0; i < n; i++) {
    c = n + i;
    for (j = i; j < c; j++) {
      temp = j % n;
      cout << isi[temp];
      if (j == c - 1) {
        cout << endl;
      } else {
        cout << " ";
      }
    }
  }
  return 0;
}
