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