n, m = map(int, input().split()) ans = [[0] * (1 << m) for i in range(1 << n)] c = 0 for i in range(1 << n): for j in range(1 << m): ans[i][j] = c c += 1 for i in range(1 << n): print(*ans[i])