using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); static int[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (v, d) = (c[0], c[1]); var ans = new int[v][]; for (var i = 0; i < v; ++i) ans[i] = new int[v]; if (d == 1) for (var i = 0; i < v; ++i) for (var j = 0; j < v; ++j) ans[i][j] = 1; else for (var i = 0; i < v; ++i) { ans[i][0] = 1; ans[0][i] = 1; } WriteLine(string.Join("\n", ans.Select(ai => string.Join(" ", ai)))); } }