def solve(n, m): N = 1 << (n + m) ans = [0] * N for i in range(N): ans[i] = i ^ (i // 2) if m & 1: for i in range(N): ans[i] ^= ans[i] >> m ans[i] ^= ans[i] << m for i in range(1 << n): for j in range(1 << m): if ans[i << m | j] < 0: # 条件を満たさない場合. print(-1, end=' ') else: print(ans[i << m | j], end=' ') print() n, m = map(int, input().split()) solve(n, m)