v, d = map(int, input().split()) if d == 1: for i in range(v): print("1" * d) else: ans = [["0"] * v for i in range(v)] for i in range(v): ans[i][0] = ans[0][i] = "1" for i in range(v): print("".join(ans[i]))