V, D = map(int, input().split()) ans = [[0] * V for i in range(V)] if V == 1: print(1) elif D == 1: for i in range(V): for j in range(V): ans[i][j] = 1 print(*ans[i], sep="") else: for i in range(V): for j in range(V): if i == V - 1 or j == V - 1: ans[i][j] = 1 print(*ans[i], sep="")