n, m = map(int, input().split()) N, M = 2**n, 2**m for q in range(0, N * M, M): print(*range(q, q + M))